Welcome! Log In Create A New Profile

Advanced

Load Balancer -> Reverse Proxy - help with IP Address X-Forwarded-For

Posted by benseb 
Load Balancer -> Reverse Proxy - help with IP Address X-Forwarded-For
June 29, 2012 05:19AM
Hi

I have the following setup:

INTERNET
\/

LOAD BALANCER RUNNING NGINX WITH UPSTREAM MODULE
\/

2 x WEB SERVERS WITH NGINX REVERSE PROXY + APACHE BACKEND


I have set up the X-Forwarded-For headers on both the load balancer and the web servers, however, the LB shows the correct IP in the logs. On the web servers, it only shows the IP address of the Load Balancer. I presume I need to change something to get the correct IP?

I am using the mod_rpaf module on the apache backend


ON LB:

server {
listen 80;
server_name www.domain.com;
proxy_connect_timeout 3s;
proxy_buffers 32 16k;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;


location / {
proxy_pass http://cluster;

}
}

ON WEB:
location / {

proxy_pass http://127.0.0.1:8080;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;



}



Many thanks
Re: Load Balancer -> Reverse Proxy - help with IP Address X-Forwarded-For
June 29, 2012 10:41AM
I have just seen this patch, would it work for my setup?

http://forum.nginx.org/read.php?29,227703,227947#REPLY

Is there any alternative to patching?
Re: Load Balancer -> Reverse Proxy - help with IP Address X-Forwarded-For
July 01, 2012 01:06PM
Can anyone help?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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