# Add\_header doesn't work when 50x

**URL:** <https://www.ruby-forum.com/t/add-header-doesnt-work-when-50x/219894>\
**Category:** NGINX\
**Created:** [May 21, 2012, 8:37am UTC](https://www.ruby-forum.com/t/add-header-doesnt-work-when-50x/219894 "2012-05-21T08:37:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gurdipe\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b77776/32.png) [@Gurdipe\_D](https://www.ruby-forum.com/u/Gurdipe_D)\
**Post date:** [May 21, 2012, 8:37am UTC](https://www.ruby-forum.com/t/add-header-doesnt-work-when-50x/219894/1 "2012-05-21T08:37:23Z")

</div>

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:

> **[add\_header doesn't work when 50x](https://forum.nginx.org/read.php?2,226677,226677#msg-226677)**
>
> 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 retur
