LoadBalancer-->Varnish-->Nginx : Real IP Address
Been scratching my head for a few hours now and wanted to see if anyone can help.
1) I have a load balancer with 6 servers in the back end.
2) The back end servers are Nginx and to get the real IP addresses of the visitors, all I have to do is the following in each Nginx install and I am able to get the real client IP address of each visitor.
setrealip_from 192.168.255.0/24; <– to handle the load balancer IP
realipheader X-Forwarded-For;
3) Now I have installed Varnish in front of each Nginx running on 127.0.0.1 doing caching and for some reason now Nginx doesn't see the real client Ip addresses anymore coming from LoadBalancer --> Varnish --> Nginx
It's printing the following:
IP address:
192.168.255.9 <-- this should be the real client IP address and not the 192.168 (assuming the load balancer IP address is being printed)
More detailed host address:
192.168.255.9
Many thank if you can help.
Dave
3 Replies
Not too sure.
//heckman
setrealip_from 127.0.0.1;
realipheader X-Forwarded-For;
Works for me with Varnish in front of Nginx on the same server. No load balancer though.