Reputation: 636
I am using nginx as a load balancer (reverse proxy) and everything looks fine till now.
The problem I am trying to solve is to somehow make nginx to understand an upstream backend server is down and do not send requests to it. By means of down, I realy mean that there is no server like that or shutdown.
Case 1 : 2 backend server defined on upstream, both running instances and 1 backend application is stopped. Than nginx understands that it is down and doesn't try to send requests again during fail_timeout (by default 10secs) -- This is ok and already acceptable.
Case 2 : 2 backend server defined on upstream but 1 real running instance. Nginx still tries to balance the requests like both of them are up and doesn't mark stopped (not existing) backend as unhealty. In this case I receive 504 gateway timeout.
What I would like to achieve is to make nginx work like case 1 and mark the backend as unhealthy w/o receiving 504 gateway timeout.
Any ideas? Configuration option?
Upvotes: 0
Views: 1570
Reputation: 636
A little more investigation on nginx configuration directed me to this configuration line. Incase anyone needs;
proxy_next_upstream error timeout http_504;
Upvotes: 2