I have an nginx setup which works very well. I am using an upstream block to load balance between two servers. These servers give HTTP 200 response even if they unable to serve the request, but they set custom http header like this:
When the response is OK, they give:
Is it possible to configure nginx to try next upstream server while the first one gives "X-Response-Status: Failed"?
I mean like following in nginx config:
proxy_next_upstream error timeout http_* ($sent_http_x_response_status="Failed")
I have to keep upstream servers giving HTTP 200 even on errors because there is an error message in http body in binary form.
I have to pass this binary error to client if none of upstream server are able to serve the request.