How to set proxy_next_upstream? and why?

You can add proxy_next_upstream in http, server, location context:

proxy_next_upstream error timeout invalid_header http_502 http_503 http_504;

There is something to notice:

    • You should add error, timeout, invalid_header since the upstream didn’t receive this request.
    • You can add http_502, http_503, http_504 because upstream meet network issue.
    • Don’t add http_500 because there is error in application, retries will cause other server is down.(And developer should fix this error, not load balancer)


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.