resolver does not re-resolve upstream servers after initial cache

Dave Nolan lists at ruby-forum.com
Thu Nov 8 10:38:42 UTC 2012


Ruslan Ermilov wrote in post #1083512:
> On Wed, Nov 07, 2012 at 09:40:49PM +0100, Dave Nolan wrote:
>>       server {
>> As I understand it, without the resolver config, nginx will resolve
>> example.com's IP once on load and cache it until it stops or fully
>> reloads the config.
>>
>> With the resolver config above, nginx should re-resolve the IP every
>> 5mins.
>
> This is not the way how it works.
>
> A run-time resolving only takes place if URL specified in "proxy_pass"
> contains variables, AND the resulting server name doesn't match any of
> the configured server groups (using the "upstream" directives).  This
> is documented here: http://nginx.org/r/proxy_pass
>
> In your case, the server name is always "myupstream" and since it
> matches "upstream myupstream", no run-time resolving takes place.

What's the reason behind this? It feels like that, even if proxy_pass
defers to the server group, resolver config should be respected for
servers defined within the group.

>
>> However, this is not happening: I can watch tcpdump -n udp port 53 but I
>> see no re-resolution taking place.
>>
>> I'd love to know how to fix this. Any advice appreciated thanks!
>
> proxy_pass http://example.com$request_uri;
>
> will resolve "example.com" dynamically (assuming of course there's
> no "upstream example.com" in configuration).

Thanks very much for your help.

If I switch to using example.com directly in the proxy_pass, I lose the
flexibility of server groups. Is there any way of dynamically
re-resolving servers in upstream server group?

-- 
Posted via http://www.ruby-forum.com/.



More information about the nginx mailing list