add_header doesn't work when 50x

neoesque nginx-forum at
Mon May 21 06:36:32 UTC 2012

Hi everybody,

I manage a server farm with more than 30+ servers using nginx.

Sometimes I forgot to start php-fpm, that is I got 502 BAD GATEWAY.

I have "add_header Host $hostname;" in my nginx.conf.

But this only enable when return code is 200 OK, there is no "Host"
Header in 502 BAD GATEWAY. 

I cannot find which machine is wrong as soon as posible.

Is there any suggestion?

Thanks a lot.

Posted at Nginx Forum:,226677,226677#msg-226677

More information about the nginx mailing list