Are headers set in the server block inherited to all location blocks

Francis Daly francis at daoine.org
Wed Feb 5 15:10:03 UTC 2014


On Wed, Feb 05, 2014 at 05:52:21PM +0400, Maxim Dounin wrote:
> On Wed, Feb 05, 2014 at 01:33:34PM +0000, Francis Daly wrote:

Hi there,

> > Can you say where you got that impression? Perhaps documentation can be
> > clarified or corrected.
> 
> It looks like add_header documentation doesn't have our usual 
> clause for array-like directives, and something like this should 
> be helpful:

I'm not sure where the best place for it is; but I'd suggest not putting
this on every directive, but only marking the few that don't follow the
common inheritance rules.

And then have an obvious document which describes what the common
inheritance rules are.

It would probably be something like the content linked from
http://blog.martinfjordvald.com/2012/08/ but could be simplified to
"inheritance is per-directive, and is all or nothing. The following are
'nothing'; the rest are 'all'. Exceptions are noted in the per-directive
documentation (and possibly listed here too)."

In the blog above, it indicates that "Action" directives do not inherit
-- I don't know if that's a useful distinction that could be made in
the documentation; it would presumably be extra work to ensure that
every directives is categorised as "inherit all", "inherit none", or
"exception", and I can't tell whether the benefit would be worth the cost.

> +These directives are inherited from the previous level if and
> +only if there are no
> +<literal>add_header</literal>
> +directives defined on the current level.

To me, that's not special for add_header -- that's common to all
inheriting directives bar the few exceptions (root/alias, allow/deny,
and xslt_param/xslt_string_param in stock nginx). 

Maybe it is easier to put it in all directive documentation, though,
if that's what people are more likely to read.

I won't be the one doing the work, so I'm not in the right place to
judge what work should be done :-)

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list