Welcome! Log In Create A New Profile

Advanced

Re: add_header isn't taking effect

Francis Daly
August 18, 2012 07:48PM
On Sat, Aug 18, 2012 at 04:31:54PM -0700, Michael Shadle wrote:

Hi there,

> It actually seems like if I add_header in one scope somewhere it will
> ignore in another.

Yes, that's the expected behaviour for nginx configuration directives.

A request is handled in exactly one location; the configuration in or
inherited into that location is what matters; inheritance or merging is
by replacement.

> For example I have one gratuitous add_header at the server {} level -
> with a different name.
>
> Then I add one on the location level.

In this location, only this one will apply. In another location, only
the server-level one will apply.

> Then I have one come from the upstream.

nginx doesn't care about headers being added; it cares about the
add_header directive. So this line should not influence the outcome.

> I could reproduce it reliably by adding an add_header somewhere and it
> would drop the other one out. I also have two environments with nearly
> exact configurations and one passes all 3 headers I want vs. 2 headers
> consistently. Very odd.

I suspect that if you compare the nearly exact configurations, you'll
spot an important difference.

If you want a specific extra add_header in a location, you must also
repeat the other add_header directives within that location.

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

add_header isn't taking effect

mike August 18, 2012 06:46PM

Re: add_header isn't taking effect

Francis Daly August 18, 2012 07:06PM

Re: add_header isn't taking effect

mike August 18, 2012 07:32PM

Re: add_header isn't taking effect

Francis Daly August 18, 2012 07:48PM

Re: add_header isn't taking effect

mike August 18, 2012 08:34PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 131
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready