Adam Horvath Adam.Horvath at
Wed May 16 09:23:44 UTC 2018

I am totally new to nginx, so please forgive me if I am wrong.

I propose the following change:
From:    if (state & NGX_PEER_FAILED)
To:      if (state & (NGX_PEER_FAILED || NGX_PEER_NEXT))

Note: The value causing us trouble:
state = NGX_PEER_NEXT // on HTTP 404
Comes from:

Regular round robin seems to work fine. But with a configuration like:
upstream live {
    server backup;

We get a nice failover for HTTP 502. But for HTTP 404 we get a forever-loop, just like the one mentioned in
Changes with nginx 1.3.0:
    *) Bugfix: nginx might loop infinitely over backends if the
       "proxy_next_upstream" directive with the "http_404" parameter was
       used and there were backup servers specified in an upstream block.

So we get looping despite the fix. The proposed edit stops the looping for us, but I cannot see the full consequences. And of course it is possible that we can fix it by just some configuration change.

What do you think?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx-devel mailing list