Welcome! Log In Create A New Profile

Advanced

nginx DNS cache?

November 20, 2023 01:31AM
Hi,
just a question... is there some sort of internal nginx DNS cache? I have a strange problem here...

basic scenario: i have multiple domains (like vhost 1) with different domains (my.domain.com, www.domainx.com etc., just example names). But all of them proxy_pass to the same intermediate vhost (vhost 2), which then sends the requests to the backends. A resolver.conf is used, using the providers DNS servers.

all configs a bit simplified...
vhost 1:
server {
listen 1.2.3.4:443 ssl;
server_name my.domain.com; # or www.domainx.com etc.
location / {
proxy_set_header proxy.otherdomain.com; # some other domains running on 2.3.4.5:443, so set the header here
proxy_pass https://proxy.otherdomain.com;
}
}

vhost 2:
server {
listen 2.3.4.5:443 ssl;
server_name proxy.otherdomain.com;
location / {
proxy_pass http://my-backends; # my-backends is an upstreamreferring to 2 identical backends
}
}

When i change the IP address of proxy.otherdomain.com in the providers DNS to e.g. 3.4.5.6 and create a vhost 3 (identical to vhost 2, but with this new IP address) on a different server (all the vhosts like vhost 1 remain unchanged), the operating system soon receives the changes (checked with ping, dig etc.) - but nginx somehow still uses the old IP (2.3.4.5 instead of 3.4.5.6) address, even after days (DNS ttl: 60s). nginx restart doesn't help.

Hope you were able to follow this long text... but is there some sort of nginx-internal DNS cache? DNS changes work (tested external and on the debian server), but only nginx doesn't seem to care and still uses an old IP.


thx,
Hubert
Subject Author Posted

nginx DNS cache?

revirii November 20, 2023 01:31AM

Re: nginx DNS cache?

revirii November 27, 2023 01:13AM

Re: nginx DNS cache?

revirii January 11, 2024 02:16AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 222
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready