Welcome! Log In Create A New Profile

Advanced

module variable get_handler() runs before filter?

August 06, 2012 04:26AM
Good day,

I am writing a filter module, that has to set a environment variable to a certain value, if a special condition is met.

For example, if there is &flag=true in the arguments, I want the PHP to see a $_SERVER[ 'FLAG_DETECTED' ] variable. (I know that you might suggest just checking for $_GET['flag'] , but what I describe here is oversimplification of an actual case)

The only way I see of doing it is adding "fastcgi_param FLAG_DETECTED $flag_var;" and then changing the $flag_var in module.

On detection of this special value (&flag=true) , my filter (inserted at ngx_http_top_header_filter) creates a context, adds it to the request ( with ngx_http_set_ctx(r,my_module)) , but when the variable's get_handle() runs ngx_http_get_module_ctx( r, my_module ), I receive NULL instead of the context.

My prints to the log show that the get_handle() runs prior to filter, and the CTX is not set
Is there any way to do what I want?
Thank you
Subject Author Posted

module variable get_handler() runs before filter?

pavleg August 06, 2012 04:26AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 84
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready