A fork of MaxMind's mod_geoip2 with more intelligent X-Forwarded-For handling, as per this post.
Currently based on mod_geoip2_1.2.7
Summary: The client-IP address in the list of addresses potentially in the X-Forwarded-For HTTP header is normally the left-most header but clients with private IP addresses using a forwarding proxy mean that you'll often get the wrong address, usually a private IP address. This module follows the rule:
Always use the leftmost non-private address.
You can compare with the current MaxMind release here.
To enable this special mode you need to turn the GeoIPUseLeftPublicXForwardedForIP flag On in your apache config.
An additional config option is also available: GeoIPEnableHostnameLookups, when set to On mod_geoip2 will attempt to resolve the matched IP address and store the result in the GEOIP_HOST environment variable. This is useful for logging or other basic remote host based configuration.
Changes for this fork are being recorded in the Changes file.
Contributions more than welcome!
Thanks to Kevin Gaudin for his contributions to fall back to the RemoteIP where we fail to find a public IP address match.
Original MaxMind README is here.
Follow the same instructions found in the original INSTALL.
See Downloads for tarballs.