Welcome! Log In Create A New Profile

Advanced

Re: Nginx/iptables passing ipclient ip

Marc Aymerich
November 30, 2013 06:22AM
On Fri, Nov 29, 2013 at 11:44 PM, Todd@VRG <nginx-forum@nginx.us> wrote:
> Hi,
>
> I have nginx reverse proxy setup on a ubuntu server to pass to webservers...
>
>
> Setup..
>
> Ubuntu-nginx
> eth1 = external_ ip
> eth0 = internal_ ip
>
> Webserver 1 ip XX1
> webserver 2 ip XX2
>
> nginx is forwarding traffic to webservers..
>
> I tried both..
>
> proxy_set_header X-Forwarded-For $remote_addr;
>
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>
> I have iptables for my firewall with proper ports and IPs open..
>
> the ip address I still see in the logs is the eth0 = internal_ ip
> I can change the ip the webserver is seeing using POSTROUTING SNAT
> iptables..
>
> This lead me to believe I have something miss configured that the Nginx can
> not pass the real client IP to the webservers..

Disclaimer: maybe I've misunderstood you :)

Do you realize that "proxy_set_header X-Forwarded-For $remote_addr;"
what would do is change the HTTP header, not the IP header.

What this means is that your internal facing web servers will see IP
traffic with SRC=internal_ip, however if you inspect the HTTP headers
of those requests, you will find that there is and
HTTP.X-Forwarded-For set to $remote_addr;

no more, no less than that :)

br
--
Marc

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

Nginx/iptables passing ipclient ip

Todd@VRG November 29, 2013 05:44PM

Re: Nginx/iptables passing ipclient ip

Francis Daly November 29, 2013 06:04PM

Re: Nginx/iptables passing ipclient ip

Marc Aymerich November 30, 2013 06:22AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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