add_header is not working in certain locations

bodomic nginx-forum at
Thu Aug 14 14:16:43 UTC 2014

Actually, the second problem is described in this document too, I think I
should re-read it every time I want to use IF.
In my example (before posting it here) I've dropped the second IF in the
same location without much thought.
That's why it worked for you. That's why it worked in a separate location -
I didn't move a second IF there, and again, did not pay enough attention to

So, the problem was the second IF in the same location. This is really not
an easy thing to understand, so it should be the sole recommendation of
denying IFs on the top of rewrite module documentation :)

Francis Daly Wrote:

> for details.
> _______________________________________________
> nginx mailing list
> nginx at

Posted at Nginx Forum:,252523,252575#msg-252575

More information about the nginx mailing list