nginx doesn't switch upstream in some cases

Guillaume Filion gfk at
Wed Feb 10 17:19:07 MSK 2010

Hi all,

We're running nginx as a load balancer in front of two reverse proxies
(Apache2/mod_security) for our web site.

It's been working great except last night apache stopped on one of the
reverse proxy and nginx would continue sending HTTP requests to it. The
result was that about 50% of the requests to the web site failed.

If I unplug the reverse proxy, nginx detects that it's down and will
only send requests to the "good" reverse proxy.

Here's my config, I guess that my "proxy_next_upstream" is wrong but I
can't figure out how... It would be great if someone could shed some
light on this issue for me.

upstream SRACQ {

server {
  access_log /var/log/nginx/www.sracq.qc.ca_HTTP.access.log;
  error_log /var/log/nginx/www.sracq.qc.ca_HTTP.error.log;

  location / {
    proxy_next_upstream error timeout invalid_header http_500;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;

    proxy_pass http://SRACQ;

Thanks a lot,
Guillaume Filion

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the nginx mailing list