Access to location configs from postconfiguration
potapov.d at gmail.com
Wed Dec 26 17:58:44 UTC 2012
I'm writing my first nginx module and want perform some per-location
initialization (and validation) in postconfiguration function.
Unfortunately I've found that only named locations can be accessed from
postconfiguration function (using the chain
I don't want to force users to named locations usage, so I'm looking for
another way to iterate over locations configs.
For now I've found the following solution:
1. In create_main_conf: create empty array of pointers to
ngx_http_core_loc_conf_t inside module main_conf
2. At the end of each merge_loc_conf function: remove pointer to parent
config from pointers array (if any) and add (or replace) pointer to child
3. In postconfiguration function: iterate through pointers array from
4. At the end of postconfiguration: free memory used for pointers array
But this seems to be bad solution.
It there any easy and built-in mechanism to iterate over location
configuration, so I can perform initialization for those where my module
was used (and appropriate module location configuration flag was set while
Thanks in advance,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the nginx