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

Rv Rv rvrv7575 at
Mon Jun 9 18:09:13 UTC 2014

How do we access the configuration of a an unrelated module in a given module. This may be required for example to check if the directives pertaining to module 2 were specified in location for a particular server that has directives for module 1 in its configuration.

From what I understand, code similar to this can be used 
/* Get http main configuration */
    cmcf = ctx->main_conf[ngx_http_core_module.ctx_index]; 

/* Get the list of servers */
    cscfp = cmcf->servers.elts;
/* Iterate through the list */
    for (s = 0; s < cmcf->servers.nelts; s++) {
  /* Problem : how to get the configuration of module 2*/
                  cscfp[s]->ctx->loc_conf[module2.ctx_index];-------------> does not yield the correct location struct of module 2

I did not find any documentation on how the configuration is stored within nginx using these structs 
typedef struct {
 /* server ctx */ ngx_http_conf_ctx_t        *ctx; ............

} ngx_http_core_srv_conf_t;

typedef struct {
    void        **main_conf;
    void        **srv_conf;
    void        **loc_conf;
} ngx_http_conf_ctx_t;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list