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
Posted at Nginx Forum: