Welcome! Log In Create A New Profile

Advanced

GeoIP behind HAProxy, howto?

Posted by halop123 
GeoIP behind HAProxy, howto?
January 03, 2011 08:23AM
Hello!
I have nginx behind HAProxy, and the geoip module seems to generate empty strings. I guess the reason is that geoIP tries to resolve HAProxy's internal IP address. Is there any way to force the geoIP module to resolve the X-Forwarded-For address?

Any help would be appriciated,
halop
Re: GeoIP behind HAProxy, howto?
January 03, 2011 10:05AM
ok worked it out... if anyones interested, haproxy needed the options [i]forwardfor[/i] (to include X-Forwarder-For in header) and [i]httpclose[/i], then nginx needs to be configured/installed with --with-http_realip_module and in nginx.conf:
http { ...
set_real_ip_from haproxy.ip.address;
real_ip_header X-Forwarded-For;
... }

location ... { ...
fastcgi_param COUNTRY $geoip_country_name;
... }
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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