How to test conditions in apache configuration

apache-2.4configurationhttpd.conf

I want to test a configuration in apache. How can I "debug" the configuration file ?
For example, let's say that I have :

<IfModule mod_geoip.c>
    GeoIPEnable On
    GeoIPDBFile PATH_TO_LIB\GeoIP.dat
    GeoIPEnableUTF8 On
    GeoIPOutput All
</IfModule>

Can i send a fake IP locally to the header ? (ie) Can I locally fake/spoff another IP than 127.0.0.1 ?

Best Answer

With that configuration you can't (at least easily). I suggest for testing, you add this option:

GeoIPScanProxyHeaders On

From the documentation (http://dev.maxmind.com/geoip/legacy/mod_geoip2/#Proxy-Related_Directives)

When this is set, the module will look at several other sources for the IP address, in this order:

The HTTP_CLIENT_IP environment variable (set by Apache).

The HTTP_X_FORWARDED_FOR environment variable (set by Apache). The X-Forwarded-For for header (set by a proxy).

The HTTP_REMOTE_ADDR environment variable (set by Apache).

Set that option for testing and remove it when done. Then you can send arbitrary IP's as HTTP headers with curl, ex:

curl --header "X-Forwarded-For: 1.2.3.4" "http://your.site/path"