[PATCH] Adds $orig_remote_addr in realip module

Valentin V. Bartenev vbart at nginx.com
Fri Jun 26 13:23:30 UTC 2015


On Thursday 25 June 2015 14:51:15 Jon Nalley wrote:
> # HG changeset patch
> # User Jon Nalley <code at bluebot.org>
> # Date 1435261685 18000
> #      Thu Jun 25 14:48:05 2015 -0500
> # Node ID 894a268769bf9b3c806a9506ea1e8daf2dac3841
> # Parent  6345822f0abb70807f635989b6c2df7852a55bd9
> Adds $orig_remote_addr in realip module
> 
> When the realip module sets $remote_addr, the connecting IP is
> no longer available for logging etc.  This change preserves the
> connecting IP as $orig_remote_addr.
> 
> diff -r 6345822f0abb -r 894a268769bf src/core/ngx_connection.h
> --- a/src/core/ngx_connection.h	Thu Jun 25 12:36:52 2015 +0300
> +++ b/src/core/ngx_connection.h	Thu Jun 25 14:48:05 2015 -0500
> @@ -145,6 +145,10 @@
>      socklen_t           socklen;
>      ngx_str_t           addr_text;
>  
> +#if (NGX_HTTP_REALIP)
> +    ngx_str_t           orig_addr_text;
> +#endif
> +
>      ngx_str_t           proxy_protocol_addr;
>  

The realip module works on a per request basis, so storing this
information inside the connection structure looks wrong to me.
 
  wbr, Valentin V. Bartenev



More information about the nginx-devel mailing list