Nginx upstream return name instead of server ip
Maxim Dounin
mdounin at mdounin.ru
Wed Sep 29 13:28:42 UTC 2021
Hello!
On Wed, Sep 29, 2021 at 09:20:20AM -0400, rjvbzeoibvpzie wrote:
> Here is my config:
>
> -----
> upstream http_backend {
> server 127.0.0.1:81;
> server 10.1.1.2 backup;
> }
>
> server {
> ...
>
> location /http/ {
> proxy_pass http://http_backend;
> ...
> }
> }
> -----
>
> As long as everything is working, $upstream_addr returns the IP
> (127.0.0.1:81). But when any backend returns HTTP/502, $upstream_addr
> returns the upstream name (http_backend) as the $upstream_addr.
>
> Shouldn't this return the lastest server IP tried before failure?
The upstream name can be seen in $upstream_addr as long as nginx
is not able to select an upstream server because all servers are
not available per max_fails/fail_timeout. The "no live upstreams"
error is logged at the same time.
--
Maxim Dounin
http://mdounin.ru/
More information about the nginx
mailing list