nginx does not resolve hostnames if there is no route
|Reported by:||Owned by:|
|uname -a:||Linux 3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018 x86_64 GNU/Linux|
|nginx -V:||nginx version: nginx/1.12.2|
In my configuration is the following line:
Problem is, that I am using it on a host without IPv4 connectivity.
This shouldn't b a problem since 127/8 can be accessed without a route over the lo interface.
But it is. nginx fails with the following message:
nginx: [emerg] host not found in upstream "localhost4" in
This should not be happening, since localhost4 can be resolved over /etc/hosts. So gethostbyname should work properly.
There is a working DNS resolution over IPv6.
A workaround would be something like that:
ip addr add 192.0.2.1/24 dev eth0 systemctl restart nginx ip addr del 192.0.2.1/24 dev eth0