ip based access behind nginx load balancer

ahlatci nginx-forum at nginx.us
Fri Jun 11 19:05:49 MSD 2010


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

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,97154,97154#msg-97154




More information about the nginx mailing list