Persisting the module request context across internal redirects

Otto van der Schaaf oschaaf at
Thu Jan 8 08:55:19 UTC 2015


For ngx_pagespeed, I'm looking for a way to persist its module request
context and restore it
even after request processing has been restarted for a named location or
internal redirect.
Keeping a single request context during this process  would allow us to
avoid repeating some work we already did earlier, like cache lookups.

For testing, I've achieved this by storing a pointer in the request headers
structure for the request and using that after an internal redirect has
been processed instead of just using ngx_http_get_module_ctx.

This works, but there are lots of reasons why I'd rather prefer not
(ab)using the request headers structure for this.

Is there a better way to keep a reference to the first module request
context in case of internal redirects?
Are there reasons why this could be a bad idea in general?

Kind regards,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx-devel mailing list