feature request: warn when domain name resolves to several addresses

Maxim Dounin mdounin at mdounin.ru
Tue Nov 19 19:01:48 UTC 2019


Hello!

On Tue, Nov 19, 2019 at 10:47:01AM -0700, Roger Pack wrote:

> I noticed that in ngx_http_proxy_module
> 
> proxy_pass http://localhost:8000/uri/;
> "If a domain name resolves to several addresses, all of them will be
> used in a round-robin fashion. In addition, an address can be
> specified as a server group."
> 
> However this can be confusing for end users who innocently put the
> domain name "localhost" then find that round-robin across ipv6 and
> ipv4 is occurring, ref:
> https://stackoverflow.com/a/58924751/32453

This seems to be your own answer, and it looks incorrect to me.  
In particular, the 499 error is logged when the client closes 
connection, and there is no need to have more than one backend 
server specified to see 499 errors.

> https://stackoverflow.com/a/52550758/32453

Changing "localhost" to "127.0.0.1" here "works" because having just 
one address triggers slightly different logic in the upstream 
code: with just one address, max_fails / fail_timeout logic is 
disabled, and nginx always uses the (only) address available, even 
if there are errors.

The underlying problem is still the same though: backends cannot 
cope with the load, and there are errors.

(And no, it's not a DNS failure - DNS is only used when nginx 
resolves the name in the proxy_pass directive while parsing 
configuration on startup.)

> Suggestion/feature request: If a domain name resolves to several
> addresses, log a warning in error.log file somehow, or at least in the
> output of -T, to warn  somehow.  Then there won't be unexpected
> round-robins occurring and "supposedly single" servers being
> considered unavailable due to timeouts, surprising people like myself.

Multiple addresses are fairy normal, and I don't think that 
logging a warning is a good idea.

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


More information about the nginx mailing list