Accessing the location configuration of module 2 during post configuration processing of module 1 for a particular server

Maxim Dounin mdounin at
Sat Jun 14 19:35:37 UTC 2014


On Thu, Jun 12, 2014 at 01:46:58PM +0800, Rv Rv wrote:


> In the post configuration, I see that flag is not properly set 
> but somestring is. Flag is properly set during request 
> processing though.
> Are the values set during processing of a directive in location 
> struct guaranteed to be set by the time post configuration is 
> executed?
> When is the time that one can check for the values set during 
> configuration. I need to test these values to ensure that they 
> are sane when nginx is executed with -t option

Again: there are lots of location configurations, and by trying to 
access them at postconfiguration callback you are likely checking 
a wrong one.  Note that even a simple config with a single 
location in a single server{} block, like this:

     http { server { location { ... } } }

has 3 location configurations for each http module.

As previously suggested, you should consider using merge callbacks 
to validate configuration instead.

Maxim Dounin

More information about the nginx mailing list