Nginx caching proxy dns name even when using variables

Maxim Dounin mdounin at
Thu Sep 27 14:53:22 UTC 2018


On Thu, Sep 27, 2018 at 03:27:03PM +0100, Rob Fulton wrote:

> I’ve done some further testing on this today and discovered that 
> the configuration works correctly when the proxy_pass url is 
> accessed via http, I can see dns queries for the proxy_server 
> url every minute as per the ttl. The moment I change the url to 
> https, this stops. Is this a known limitation?

Most likely, the problem is that you have


somewhere in the configuration, without variables - so nginx 
resolves the name during configuration parsing.  As a result, your 

    set $proxy_server;
    proxy_pass https://$proxy_server;

does not try to resolve the name, but rather ends up using the 
existing upstream for

If you want the name to be always resolved, comment out the 
proxy_pass without variables and/or use the variables there as 

Maxim Dounin

More information about the nginx mailing list