module context.

Dk Jack dnj0496 at gmail.com
Tue Aug 18 07:11:23 UTC 2020


Hi,
I have a module. I am saving some data in my module context. However, in
certain cases, I am doing an internal redirect. When I do an internal
redirect my context is cleared as per the nginx development guide. Is there
a way to save the context data. Since this data is specific to the request,
I want to save it in the ngx_http_request_t if possible.

My current solution is to save it as header values and retrieve them later
after the internal redirect has happened. I am setting a special header to
say, I've saved data. This is not an elegant solution but it works. The
problem is, since I am saving it in headers, the header I added to save my
context data is being sent to the origin as a header. After restoring my
context, I tried setting the header key and value lengths to zero and also
tried setting header hash to zero. None of these things seem to help and
the header is still getting transmitted.

Two questions: Is there a way to save module context data in
ngx_http_request_t when an internal redirect happens? If not, is there a
way to prevent the custom headers add by module from going out? Thanks for
help.

Dk.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20200818/860cfe94/attachment.htm>


More information about the nginx-devel mailing list