# Add\_header works in server but not in http?

**URL:** <https://www.ruby-forum.com/t/add-header-works-in-server-but-not-in-http/206982>\
**Category:** NGINX\
**Created:** [May 15, 2011, 5:48am UTC](https://www.ruby-forum.com/t/add-header-works-in-server-but-not-in-http/206982 "2011-05-15T05:48:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [May 15, 2011, 5:48am UTC](https://www.ruby-forum.com/t/add-header-works-in-server-but-not-in-http/206982/1 "2011-05-15T05:48:46Z")

</div>

Hello, I decided I’d clean up my configuration files for Nginx. It’s  
long overdue.

I have the following in my nginx.conf but is never sent. I don’t have  
another reference to this header anywhere.

add\_header X-UA-Compatible  
‘IE=edge,chrome=1’;

Moreover, if I move the line into a Server block, it works fine.

Docs say can be used in Http, Server and Location. I’m at a loss.

Bret

Posted at Nginx Forum:

> **[add\_header works in server but not in http?](https://forum.nginx.org/read.php?2,198143,198143#msg-198143)**
>
> Hello, I decided I'd clean up my configuration files for Nginx. It's long overdue. I have the following in my nginx.conf but is never sent. I don't have another reference to this header anywhere. add\_header X-UA-Compatible 'IE=edge,chro

---

<div class="post-metadata">

**Author:** ![holstebm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/c57346/32.png) [@holstebm](https://www.ruby-forum.com/u/holstebm)\
**Post date:** [May 15, 2011, 5:58am UTC](https://www.ruby-forum.com/t/add-header-works-in-server-but-not-in-http/206982/2 "2011-05-15T05:58:46Z")

</div>

Okay, then, a little more detail. In my Server block, I had an  
add\_header for Cache-control. When I remove that add\_header, the other  
one in Http appears. If I put both in Http they both appear. If I put  
both in Server they both appear but it seems that the add\_header removes  
the headers from the parent blocks. I don’t think that was the previous  
behavior.

Posted at Nginx Forum:

> **[Re: add\_header works in server but not in http?](https://forum.nginx.org/read.php?2,198143,198147#msg-198147)**
>
> Hello, I decided I'd clean up my configuration files for Nginx. It's long overdue. I have the following in my nginx.conf but is never sent. I don't have another reference to this header anywhere. add\_header X-UA-Compatible 'IE=edge,chro

---

<div class="post-metadata">

**Author:** ![holstebm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/c57346/32.png) [@holstebm](https://www.ruby-forum.com/u/holstebm)\
**Post date:** [May 15, 2011, 2:52pm UTC](https://www.ruby-forum.com/t/add-header-works-in-server-but-not-in-http/206982/3 "2011-05-15T14:52:46Z")

</div>

On Sat, May 14, 2011 at 11:58:26PM -0400, holstebm wrote:

> Okay, then, a little more detail. In my Server block, I had an  
> add\_header for Cache-control. When I remove that add\_header, the other  
> one in Http appears. If I put both in Http they both appear. If I put  
> both in Server they both appear but it seems that the add\_header removes  
> the headers from the parent blocks. I don’t think that was the previous  
> behavior.

add\_header is inherited if there is no add\_header on the current level.  
This behavior was from from the very start.

–  
Igor S.

---

<div class="post-metadata">

**Author:** ![holstebm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/c57346/32.png) [@holstebm](https://www.ruby-forum.com/u/holstebm)\
**Post date:** [May 15, 2011, 4:50pm UTC](https://www.ruby-forum.com/t/add-header-works-in-server-but-not-in-http/206982/4 "2011-05-15T16:50:09Z")

</div>

I feel a little foolish. I checked the WIKI and it says “Note that it  
just appends a new header entry to the output header list.” but doesn’t  
say anything about the behavior you describe. I guess I hadn’t noted  
this until I started moving things around so that they make more logical  
sense in my config files. I had thought add\_header to be cumulative  
from parent to child when the headers were different (i.e. Cache-Control  
in one block, X-UA-Compatible in another).

I didn’t mean to waste your time with this. I know this is a huge  
project and I very much appreciate your hard work.

Posted at Nginx Forum:

> **[Re: add\_header works in server but not in http?](https://forum.nginx.org/read.php?2,198143,198231#msg-198231)**
>
> Hello, I decided I'd clean up my configuration files for Nginx. It's long overdue. I have the following in my nginx.conf but is never sent. I don't have another reference to this header anywhere. add\_header X-UA-Compatible 'IE=edge,chro
