<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div class="" style="">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.</div><div class="" style=""><br class="" style=""></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; font-style: normal; background-color: transparent;" class="">From what I understand, code similar to this can be used </div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent;" class=""><span style="font-style: italic;" class="">/* Get http main configuration */</span></div><div
style="background-color: transparent;" class=""><span style="font-style: italic;" class=""> cmcf = ctx->main_conf[ngx_http_core_module.ctx_index]; </span><br class="" style=""></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; font-style: normal; background-color: transparent;" class=""><span style="font-style: italic;" class="">/* Get the list of servers */</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; font-style: italic; background-color: transparent;" class=""><span style="font-style: italic;" class=""></span></div><div style="background-color: transparent;" class=""><span style="font-style: italic;" class=""> cscfp = cmcf->servers.elts;</span></div><div class="" style=""><span style="font-style: italic;" class="">/* Iterate through the list */</span></div><div class=""
style=""><div class="" style=""><span style="font-style: italic;" class=""> for (s = 0; s < cmcf->servers.nelts; s++) {</span></div><div class="" style=""> /* <span style="font-style: italic;" class="">Problem : how to get the configuration of module 2*/</span></div><div class="" style=""><div class="" style=""><span style="font-style: italic;" class=""> cscfp[s]->ctx->loc_conf[module2.ctx_index];-------------> does not yield the correct location struct of module 2</span></div><div class="" style=""><span style="font-style: italic;" class=""><br class="" style=""></span></div><div class="" style=""><span style="font-style: italic;" class="">I did not find any documentation on how the configuration is stored within nginx using these structs </span></div><div class="" style=""><span class="" style=""><div class="" style="font-style: italic;">typedef struct
{</div><div class="" style="font-style: italic;">.............</div><div class="" style=""><span style="font-style: italic;" class=""> </span><span class="" style="font-style: italic; white-space: pre;"> </span><span style="font-style: italic;" class="">/* server ctx */
ngx_http_conf_ctx_t *ctx;</span></div></span><span style="font-style: italic;" class=""> ............<br class="" style=""></span></div><div class="" style=""><span style="font-style: italic;" class=""><div class="" style="">} ngx_http_core_srv_conf_t;</div><div class="" style=""><br class="" style=""></div></span></div><div class="" style=""><br class="" style=""></div><div class="" style=""><span style="font-style: italic;" class=""><div class="" style="">typedef struct {</div><div class="" style=""> void **main_conf;</div><div class="" style=""> void **srv_conf;</div><div class="" style=""> void **loc_conf;</div><div class="" style="">} ngx_http_conf_ctx_t;</div><div class="" style=""><br class="" style=""></div></span></div><div class="" style=""><br class="" style=""></div></div></div></div></body></html>