input required on proxy_next_upstream

Igor A. Ippolitov iippolitov at nginx.com
Fri Feb 17 21:11:06 UTC 2017


Could it happen, that all servers reply with HTTP 503?
I suggest you could extend your logs with upstream_status variable and 
if there is only one upstream reply status - try looking through error logs.


On 15.02.2017 20:17, Kaustubh Deorukhkar wrote:
> Hi,
>
> We are using nginx as reverse proxy and have a set of upstream servers 
> configured
> with upstream next enabled for few error conditions to try next 
> upstream server.
> For some reason this is not working. Can someone suggest if am missing 
> something?
>
> http {
> ...
>   upstream myservice {
>     server localhost:8081;
>     server localhost:8082;
>   }
>
>   server {
>     ...
>     location / {
>       proxy_pass http://myservice <http://myservice/>;
>       proxy_next_upstream error timeout invalid_header http_502 
> http_503 http_504;
>     }
>   }
> }
>
> So what i want is if any upstream server gives the above errors, it 
> should try
> the next upstream instance, but it does not and just reports error to 
> clients.
>
> Note that, in my case one of the upstream server responds early for 
> some PUT request with 503 before entire request is read by upstream. I 
> understand that nginx closes the current upstream connection where it 
> received early response, but i expect it to try the next upstream 
> server as configured for the same request before it responds with 
> error to client.
>
> Am I missing some nginx trick here?
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20170218/9dc7f35d/attachment.html>


More information about the nginx mailing list