Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
GeoIP module for Apache httpd 2.x
C PHP
branch: master

This branch is 17 commits ahead, 63 commits behind maxmind:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
Changes
INSTALL
README
README.md
README.php
mod_geoip.c

README.md

mod_geoip2_xff

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.

Something went wrong with that request. Please try again.