realip and remote_port

Maxim Dounin mdounin at mdounin.ru
Sat Feb 25 23:16:43 UTC 2017


Hello!

On Wed, Feb 22, 2017 at 04:58:50PM -0500, xxdesmus wrote:

> I can confirm I see the same thing.
> 
> If you use set_real_ip_from, real_ip_header, etc then it wipes out the
> $server_port value.

The $server_port variable is not expected to be changed by the 
realip module.  If you see it changed - you may want to provide 
more details.

The original question you are answering to, as asked two years 
ago, was about $remote_port.  The $remote_port is somewhat 
expected to be cleared as long as the address of the client as 
seen in the header configured only contains the address itself, 
and not the port.  And this is usually the case.  Starting with 
nginx 1.11.0, the realip module is able to recognize and use 
addresses with ports from the header, see CHANGES:

    *) Feature: the ngx_http_realip_module is now able to set the client
       port in addition to the address.

But it is not something usually configured and/or available from 
normal proxies in the X-Forwarded-For header.

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


More information about the nginx mailing list