You can add
proxy_next_upstream error timeout invalid_header http_502 http_503 http_504;
There is something to notice:
- You should add
since the upstream didn’t receive this request.
- You can add
http_504because upstream meet network issue.
- Don’t add
http_500because there is error in application, retries will cause other server is down.(And developer should fix this error, not load balancer)