DNS Caching Issue For community version

Francis Daly francis at daoine.org
Mon May 16 23:05:08 UTC 2016

On Fri, May 13, 2016 at 02:13:05AM -0400, RT.Nat wrote:

Hi there,

why do you think that this does not work?

As in: what request do you make that give you an unexpected response? And
can you also show the "dig" command that shows that the nominated dns
server has changed the resolution address that it provides?

> I tried adding the variable for resolving the dns but still the ip address
> does not changes. Is there any other way? or is there any bug in my script.

When I use:

  http {
    server {
      listen 8080;
      resolver valid=20s;
      set $up "www.example.net";
      location / {
        proxy_pass http://$up;

I can do:

  date; while :; do curl; sleep 3; done

and I can also do

  tcpdump -nn port 53

and the first command shows the remote web server content every few
seconds, while the second command show that a new dns request is made
more than 20 seconds after the previous one:

21:31:00.572450 IP > 12516+ A? www.example.net. (33)
21:31:00.631578 IP > 12516 1/0/0 A (49)
21:31:23.829429 IP > 5096+ A? www.example.net. (33)
21:31:23.873474 IP > 5096 1/0/0 A (49)
21:31:47.135984 IP > 37996+ A? www.example.net. (33)
21:31:47.165754 IP > 37996 1/0/0 A (49)

Now, I don't control the google name server, and I can't make
www.example.net get an updated address at will; but the above does seem
to show that the nginx resolver is making a fresh dns request when it
is supposed to.

Do you see something else in your test?

Francis Daly        francis at daoine.org

More information about the nginx mailing list