Welcome! Log In Create A New Profile

Advanced

module development: sharing data between different request phases

Severin Schoepke
March 25, 2015 06:22AM
Hello there,

I'm in the process of writing a custom nginx module that should do some header
manipulation and some logging of strings created in that manipulation process.
The module/nginx then proxies the requests to another backend...

So far I have implemented a handler function that does the header manipulation
and added it to the ACCESS phase. Now I'm implementing a handler function that
should log some temporary data from the header manipulation to a file and added
it to the LOG phase.

Now I'm wondering how I can share/transfer some data/strings from the ACCESS
phase handler to the LOG phase handler?
- Is there some arbitrary user storage associated with a ngx_http_request_t that
I could use?
- Could I use variables for that? If so: how do I set a per-request variable in
one handler and read it in another?
- Or do I need to use a hack like storing the data in a X-Log-Data in either
headers_in or headers_out and reading it from this header in the log handler?
This feels very hacky and would expose the log data to the either the client or
the backend...
- Is there another hacky solution that I could use?

Thanks a lot!

cheers, Severin

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

module development: sharing data between different request phases

Severin Schoepke 588 March 25, 2015 06:22AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 243
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready