Welcome! Log In Create A New Profile

Advanced

ip based access behind nginx load balancer

June 11, 2010 11:05AM
I'm sure this has been asked before, but I could not find an answer.I'm using nginx-0.7.66.I have 6 webservers running Apache, tomcat, IIS on it. We are using ip base access for some directories and files on our servers.But when we use nginx as a load balancer, these rules (ip based access on apache,tomcat and IIS) are not working , because of our servers are seeing Nginx's ip address as client ip address.

Does anybody know how I can pass client's ip addresses directly through our servers on Nginx?

here is our sample nginx.conf
#########################

#user nobody;
worker_processes 16;

error_log logs/error.log;
pid logs/nginx.pid;


events {
worker_connections 1024;
}

upstream webserver_a {
ip_hash;
server 192.168.100.4:80;
server 192.168.100.5:80;
}

server {
listen *:80;
server_name our.domain.com;
access_log logs/webserver_a.access.log;


location / {

proxy_set_header X-Real-IP $remote_addr;
# needed for HTTPS
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_max_temp_file_size 0;

proxy_pass http://webserser_a;
} # location
} # server
} # http
Subject Author Posted

ip based access behind nginx load balancer

ahlatci June 11, 2010 11:05AM

Re: ip based access behind nginx load balancer

Reinis Rozitis June 11, 2010 01:04PM

Re: ip based access behind nginx load balancer

Reinis Rozitis June 11, 2010 01:24PM

Re: ip based access behind nginx load balancer

ahlatci June 11, 2010 01:36PM

Re: ip based access behind nginx load balancer

Reinis Rozitis June 11, 2010 03:28PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 93
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready