Is it possible to make Nginx HttpGeoIPModule use the X_Forwarded IP that is sent via HAProxy? It is currently just using the incorrect server IP, but unsure how I can make Nginx use the X_Forwarded IP.
Any ideas?
|
|
Have you tried using the RealIPModule and setting the X-Real-IP to X-Forwarded-For You have to pass --with-http_realip_module during compile time to build the module because it is not built by default. |
|||||||
|
|
Sameer's answer is correct. You'll need to configure and compile Nginx with the --with-http_realip_module option. Then set the following option in the Nginx configuration:
Where 1.2.3.4 is the IP Address of HAProxy In HAProxy you'll need the following options:
I found this website helpful: http://www.somerorbay.com/vps-and-dedicated/nginx-behind-haproxy-x-forwarded-for-getting-real-client-ip |
|||
|
|
Another option is to run HA Proxy in transparent mode, then all IPs will display correctly. Usually a little IP Tables 'mangling' is needed to make it work, but well worth the effort. |
|||
|
|