-
I can set a handler to one of several “phases”, like:
“NGX_HTTP_REWRITE_PHASE”, “NGX_HTTP_CONTENT_PHASE” and other. How to
define an order the handlers will be called inside the same “phase”?
Lets suppose i bond several handlers to some phase and what will be
called first? If that order is depends on order of modules “loading”,
how to define that order of modules loading? -
I developed a module that creates new variable “$z” during
initialization. That variable can be used in configuration file. When
nginx meets $z in configuration file, my handler is invoking (handler
that returning the content of $z). If configuration file has three
occurrences in the configuration file, my handler called 3 times. But i
have a situation: the handler is calling 2 times per one variable. So it
called 6 times for 3 occurrences of $z. Why? (that handler is called
“get_handler”). -
OK. Lets suppose (2) is resolved. I want to create the content of $z
once per request, but the “get_handler” can be invoked N times for the
same request. Where i can set the content of $z between “get_handler”
invocations for the same request? -
I want to rewrite the ARGS from the request: i need to add “&z=1” to
the end of args. For example: “a=1&b=1” —> “a=1&b=2&z=1”. But inside
the handler i have access to ngx_http_request_t via pointer. And i have
access to that ARGS via member “args” of the structure
“ngx_http_request_t”. That “args” member is a “ngx_str_t”. How can i
change its length? I tried to create a new string and rewrite old
pointer (r → args = new_str_ptr), but it is not working. Seems to be i
have a copy of request during handler invocation and nginx killing that
copy after request is processed?
Posted at Nginx Forum: