proxy_pass does not resolve DNS using /etc/hosts

Mark picture Mark · May 1, 2015 · Viewed 17.8k times · Source

In nginx the proxy_pass directive is not resolving DNS using the /etc/hosts file. Any way to enable this possibility (maybe by leveraging Lua as a last resort)?

Answer

Aiman Alsari picture Aiman Alsari · Aug 28, 2015

In short, you need to install dnsmasq locally and use 127.0.0.1 as a resolver.

See this related question and answer:

When using proxy_pass, can /etc/hosts be used to resolve domain names instead of "resolver"?