DNS Caching Issue For community version

Maxim Dounin mdounin at mdounin.ru
Thu May 12 11:36:36 UTC 2016


Hello!

On Thu, May 12, 2016 at 06:11:36AM -0400, RT.Nat wrote:

> I wanted check whether the resolver solves the DNS in a dynamic manner when
> the ip addresses changes.
> 
> So I add the given code after several findings and yet the resolving the ip
> address is not happening.
> 
> server{
> ...........
> 
> resolver 8.8.8.8 valid=30s;
> resolver_timeout 10s;
> set $upstream "example.net";
> 
> location / {
>                 rewrite ^/(.*) /$1 break;
>                 proxy_pass https://$upstream:3000;
>             
> 
>         }
> 
> }

Note if you have upstream "example.net" defined elsewhere, nginx 
will use it, and dynamic DNS resolution will not be used.  Note 
well that upstream may be defined either explicitly, using

    upstream example.net {
        ...
    }

or implicitly, using a proxy_pass to the given name:

    proxy_pass http://example.net;

The latter sometimes confuses people trying to use proxy_pass with 
variables to trigger dynamic DNS resolution of upstream names.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list