Welcome! Log In Create A New Profile

Advanced

Re: handler before proxy-pass

Maxim Dounin
May 29, 2014 08:30AM
Hello!

On Thu, May 29, 2014 at 03:05:15PM +0300, Donatas Abraitis wrote:

> Hello,
>
> I want to add a custom 'handler', which would update ngx_os_argv[0] on
> request. It should be like this:
>
> root 18601 0.0 0.0 62272 3812 ? Ss 07:00 0:00 nginx:
> master process /opt/nginx/bin/nginx -c /opt/nginx/etc/nginx.conf
> web 18602 0.0 0.0 70372 7904 ? S 07:00 0:00 \_
> 183.54.68.10 [test.domain.com] GET /ok.php HTTP/1.1??Host
>
> It works if using only nginx for static content, but if having proxy_pass
> in location directive it doesn't work.

This isn't going to work in any case, as there are multiple
requests in a single worker process.

> Code snippet is like this:
>
> {
> ...
> sprintf(title, "%s [%s] %s", r->connection->addr_text.data,
> r->headers_in.server.data, r->request_line.data);
> memcpy(ngx_os_argv[0], title, MAXBUF);
> return NGX_DECLINED;
> }
>
> Question is, how to solve this problem to update ngx_os_argv[0] if using
> together with proxy_pass? Seems it bypass my 'handler' if using proxy_pass.
> Maybe there is some kind of sequence of loading modules?

From what you write it looks like you've installed your code as a
content handler. You should instead use something like postread
phase handler, see e.g. realip module for an example. But, well,
it's not going to work anyway, see above.

--
Maxim Dounin
http://nginx.org/

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

handler before proxy-pass

Donatas Abraitis 675 May 29, 2014 08:06AM

Re: handler before proxy-pass

Maxim Dounin 406 May 29, 2014 08:30AM



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

Online Users

Guests: 194
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