NGINX_PROXY_PASS_URL use long cache DNS resolution
FrancYescO opened this issue · 5 comments
i was using
NGINX_PROXY_PASS_URL=http://registry:5000
and another container on the same stack with the "registry" name, all is working good until the registry container get update/restarted and changes IP... seems the ui will take a pretty infinite cache of the old DNS resolution of the registry name causing, when accessing the UI
[error] 176#176: *2 connect() failed (111: Connection refused) while connecting to upstream, client: 10.171.3.6, server: localhost, request: "GET /v2/_catalog?n=1000 HTTP/1.1", upstream: "http://10.171.3.5:5000/v2/_catalog?n=1000"
just restarting the UI container fixes the issue
i've also tested ping registry
from container shell before restarting and the IP of registry container was the correct one
here some more detail on the issue that seems pretty related to nginx
https://serverfault.com/questions/240476/how-to-force-nginx-to-resolve-dns-of-a-dynamic-hostname-everytime-when-doing-p
Hi, thank you for using my project an submitting issue. You're totally right, this is a common issue where nginx is saving the IP after a DNS query and will not update it.
Sorry for the late release, should be available in 2.5.3
Hi there
Due to a regression caused by this fix and affecting kubernetes users, in the next release 2.5.5 you will need to use the option NGINX_RESOLVER
set to 127.0.0.11
to have the same effect
hello, what if during bootstrap make a stub request to 127.0.0.11 and if get replied automatically set NGINX_RESOLVER? this to avoid the need to have this to be manually set
This needs dig
to be installed and will make the bundle heavier since it's not by default...
But this is also useful when your resolver is outside the docker network. That's why I chose this option.