Setting or clearing request->args
Maxim Dounin
mdounin at mdounin.ru
Tue Sep 22 18:18:57 MSD 2009
Hello!
On Tue, Sep 22, 2009 at 04:21:51AM -0400, leki75 wrote:
> Hello,
>
> I try to write a nginx http module which decides to enable or forbid a HTTP request sent in the request parameters (r->args). At the end of decision I would like to clear the whole args or just a part of it, so won't appear in access.log of the origin server.
>
> Is this solution correct without freeing args before?
>
> static ngx_int_t
> ngx_http_leki_test_handler(ngx_http_request_t *r)
> {
> ...
> r->args.len = 0;
> r->args.data = NULL;
+ r->valid_unparsed_uri = 0;
> ngx_log_error(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "OK", 0);
> return NGX_OK;
> }
>
> Config example:
> ...
> location / {
> leki_test on;
> http://test;
I suppose you mean "proxy_pass http://test;" here.
As it's proxy_pass without uri component - it uses original uri
with arguments (r->unparsed_uri, available as $request_uri
variable) if it's valid instead of reconstructing it from r->uri
and r->args. That's why still see original arguments on backend
with your code.
Maxim Dounin
> }
> ...
>
> Thanks in advance,
> Leki
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,8327,8327#msg-8327
>
>
More information about the nginx
mailing list