question about ngx_http_named_location

agentzh agentzh at
Fri Aug 31 22:33:39 UTC 2012


On Wed, Aug 29, 2012 at 4:43 AM, Anatoli Marinov <toli at> wrote:
> I am wondering why in ngx_http_named_location is used a segment of code that
> resets all modules contexts. I mean the line ngx_memzero(r->ctx, sizeof(void
> *) * ngx_http_max_module);.
> My opinion is that the module context should not be touched outside of the
> certain module. Is there a special reason for this patch? Is there a case
> which requires it?

If you're tracking contexts for subrequests that may initiate internal
redirects via ngx_http_named_location, then you can restore your ctx
pointer from something like the post_subrequest in places like your
own output header filters. I'm doing this in both the ngx_srcache and
ngx_lua modules (at least) :)

Best regards,

More information about the nginx-devel mailing list