This repository has been archived by the owner. It is now read-only.
GeoIP module for Apache httpd 2.x
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 17 commits ahead, 67 commits behind maxmind:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


mod_geoip2 with fancy, new-fangled X-Forwarded-For handling

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.