Nginx real_ip_recursive

Maxim Dounin mdounin at mdounin.ru
Mon Sep 15 13:25:49 UTC 2014


Hello!

On Mon, Sep 15, 2014 at 09:11:37AM -0400, ianjoneill wrote:

> Hello,
> 
> I am using nginx to proxy connections to a server I have written in Java,
> which serves connections on port 8080. I am trying to use the
> X-Forwarded-For header to identify the real IP address of a connection, but
> I am running into difficulties with the nginx setting real_ip_recursive.

[...]

>     #proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

[...]

> This proxies requests onto my server as I expect, but I do not receive the
> correct IP address in the X-Forwarded-For header. If I connect to the server
> from a different IP address, spoofing the X-Forwarded-For header, I do not
> get the IP address of the machine, but rather get the spoofed addresses.

In your configuration, "proxy_set_header X-Forwarded-For" is 
commented out.  Therefore, the X-Forwarded-For header is passed 
unmodified to the backend.

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



More information about the nginx mailing list