I wanted to use nginx to switch between servers when an 500 error code is send as reply from an upstream server to a request from the client. How can this be done?
Use *proxy_next_upstream* in location.
valid choices include: error|timeout|invalid_header|http_500|http_502|http_503|http_404 etc. Can be combined using space as a delimiter: