Does Nginx honor DNS TTLs for proxy upstreams?

csg nginx-forum at nginx.us
Mon Sep 26 08:42:07 UTC 2011


I have a short question on Nginx's proxy module. In our setup we reverse
proxy specific requests to the server of an external partner via
proxy_pass. Over the weekend the partner updated DNS but Nginx wasn't
catching up the change and still sent traffic to the old server despite
the fact the TTL of the record was little enough.

An additional obstacle might be that in our case we have for example

proxy_pass http://foo.example.com;

where foo.example.com is a CNAME to bar.example.com (TTL of 1 hour)
which is a A record (TTL of 60 seconds).

Does Nginx honor DNS changes for upstream proxies or are lookups only
done once on startup? If not, will the TTL being honor even if it has to
traverse a list of CNAME records until it hits an A record?

Both configuration directives, resolver and resolver_timeout are not
set, therefore the default of 30 seconds should apply (if that is
relevant here).

$ nginx -V
nginx: nginx version: nginx/1.0.3
nginx: configure arguments: --prefix=/usr/share/nginx
--conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/sbin/nginx
--http-log-path=/var/log/nginx/access.log
--error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid
--user=nginx --group=nginx --with-http_geoip_module
--with-http_gzip_static_module --with-http_realip_module
--with-http_secure_link_module --with-http_stub_status_module
--add-module=../agentzh-echo-nginx-module-1c4e116
--add-module=../ngx-fancyindex-0.3.1
--add-module=../agentzh-headers-more-nginx-module-2cbbc15

Thanks in advance!

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,215830,215830#msg-215830



More information about the nginx mailing list