nginx DNS doesn't update the upstream IP

Maxim Dounin mdounin at mdounin.ru
Wed Apr 14 20:18:02 UTC 2021


Hello!

On Wed, Apr 14, 2021 at 01:19:08PM -0400, kay wrote:

> Here is an example of the proxy_pass config, we don't use IP's
> 
> proxy_pass https://example.com;
> 
> When "example.com" changes the IP address, it is not reflected in nginx.
> We're using k8s pods. Sometime one or two pods have stale DNS cache. Other
> pods work fine...

That's exactly how it is expected to work: names in the 
configuration are resolved during configuration parsing.  If you 
want to re-resolve names, you have to reload the configuration.

Alternatively, you can configure proxy_pass using variables.  As 
documented in http://nginx.org/r/proxy_pass:

: Parameter value can contain variables. In this case, if an 
: address is specified as a domain name, the name is searched among 
: the described server groups, and, if not found, is determined 
: using a resolver.

Hope this helps.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx mailing list