L
L
LRC2012-05-11 13:03:29
Nginx
LRC, 2012-05-11 13:03:29

How to make nginx handle 400 error from proxy?

Gentlemen, I ask for help, Google read 5 times.
I'm setting up nginx as a front for two servers with iis.
IIS falls very cleverly (or rather, I’m still testing it), if IIS service is stopped, then connections come to port 80 and a 400 bad request error arrives in response and then the client sees: either a bad request, then the site is half loaded.

My settings are as follows: The question is how do I get nginx to handle a 400 error from the proxy and try to ask the second backend?
upstream backend {
server 192.168.194.178;
server 192.168.194.187;
}

server {
listen censored;
server_name censored;
location / {
proxy_pass backend/;
proxy_next_upstream invalid_header error timeout http_404;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host censored;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
access_log /var/log/nginx/billing.access_log main;
error_log /var/log/nginx/billing.error_log info;


Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
avalak, 2012-05-11
@avalak

Nginx wiki:
error_page
proxy_intercept_errors
400 Bad Request - The server encountered a syntax error in the client's request. I doubt that a second request will solve the problem.

L
LRC, 2012-05-11
@LRC

The request is simple (just a call to the root), just like that, iis answers, the exact same request to the second server works fine. now we are fixing iis because it is bad, but still I want to know for the future

L
LRC, 2012-06-22
@LRC

people, but in general, how do you solve the problem of the fact that if nginx scatters around the iis farm and one iis dies, then Windows as a whole listens to port 80, but the site is no longer there
, and then even having two servers in the farm, if one fails, we get, either service unavailable, or a site without half of the pictures and scripts,
how to configure nginix so that it will turn off the problem site

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question