Possible bug - hostname-defined upstream locations, bind addresses, etc. from /etc/hosts not referenced at some load times

Thomas Ward (Dark-Net) teward at dark-net.net
Fri May 15 20:51:38 UTC 2015


Long subject, I know, but this has been noticed in NGINX 1.6.x, 1.7.x,
1.8.x, and my 1.9.x from-source builds.

The documentation for 'listen', 'upstream' blocks, and many other
things does state hostnames are usable in binding and proxying.  While
this is very understandable, I think we have a few issues in there,
perhaps even bugs.

At some system boots, /etc/hosts is not read or interpreted by nginx.
Therefore, I run into resolution issues for addresses that are defined
in teh local /etc/hosts file.  Running nginx as a service *after* a
reboot seems to make the binding work, but this is an issue that has
cropped up multiple times downstream on bugs on my radar in Debian and
Ubuntu, and even on my own packaging of the nginx source code.  I've
also replicated it on the nginx.org repository as well.

Is there some way to enforce nginx checking the /etc/hosts?  Or is
this just a system boot time race condition where nginx tries to load
before /etc/hosts and the underlying system/kernel DNS handling (which
states that /etc/hosts has resolution or such) isn't initiated yet?


Thomas



More information about the nginx-devel mailing list