input required on proxy_next_upstream

Kaustubh Deorukhkar kaustubh.deo at
Wed Feb 15 07:57:53 UTC 2017


We are using nginx as reverse proxy and have a set of upstream servers
with upstream next enabled for few error conditions to try next upstream
For some reason this is not working. Can someone suggest if am missing

http {
  upstream myservice {
    server localhost:8081;
    server localhost:8082;

  server {
    location / {
      proxy_pass http://myservice;
      proxy_next_upstream error timeout invalid_header http_502 http_503

So what i want is if any upstream server gives the above errors, it should
the next upstream instance, but it does not and just reports error to

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?

Thanks in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx-devel mailing list