On Fri, Oct 06, 2017 at 07:32:51PM +0000, Lucas Rolff wrote:

Hi there,

> I know that there’s some settings such as proxy_pass which can’t inherit from 
> the parent location or server block, however – is there any semi-easy way to 
> figure out if a directive in nginx or it’s modules gets inherited or not? (I 
> don’t mind digging around in some nginx source code)

> I wonder if someone either knows a good way to figure out, or any document on 
> the web that goes extensively into explaining what (might) inherit based on 
> general design patterns.

My quick response, without doing too much research, is:

* "rewrite" module directives (if, return) don't inherit
* "handler" directives (proxy_pass, fastcgi_pass) don't inherit
* pretty much anything else that is valid in "location" does inherit

(That's probably not correct, but could be a good starting point for
experimentation.)

And be aware that inheritance is by replacement, or not at all -- so one
"add_header" in a location means that the only "add_header" relevant
to that location is the one that is there; while no "add_header" in a
location means that all of the ones inherited from server{} are relevant.


If you want the full details, it's a matter of Read The Fine Source --
each module has a "_module_ctx" which includes a function typically named
"_merge_loc_conf" which shows how each directive is set if it is not
defined in this location: unset, set to a default value, or inherited
from the previous level.

        f
-- 
Francis Daly        fran...@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to