httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Raymond Zeilstra" <>
Subject [users@httpd] Apache reverse proxy / mod_rewrite behaviour
Date Fri, 29 Jan 2010 09:49:07 GMT


I'm trying to redirect visitors from certain countries using GeoIP. I'm
using Apache reverse proxy and pound as loadbalancer:

Ubuntu Server 9.01 64bits
Apache 2.2.11 (mod_proxy, mod_proxy_http, mod_cache, mod_disk_cache,
mod_rewrite, mod_geoip)

The problem I'm encountering is that the first time a request is being
rewritten and redirected, but after a few times it's ignoring the
rewrite rules.
Here's the Apache config:


GeoIPEnable On
GeoIPScanProxyHeaders On
GeoIPDBFile /www/GeoIP.dat

RewriteEngine On

RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(nl|be)$ [NC]
RewriteCond %{HTTP_HOST} !^(nl|be)\.domain\.com$ [NC]
RewriteRule ^(.*)$$1 [L]

LogFormat "%{X-Forwarded-For}i %{Host}i %l %u %t \"%r\" %>s %b
\"%{Referer}i\" \"%{User-Agent}i\" %D"
TransferLog /apache/logs/
ErrorLog /apache/logs/

ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all

ProxyPass /
ProxyPassReverse /
ProxyPreserveHost On

CacheRoot /cachedisk
CacheEnable disk /
CacheMaxFileSize 10000000
CacheDirLevels 5
CacheDirLength 1


Now a wget gives me the following result with an empty disk cache:

# wget
Connecting to||:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: [following]

This is what I want, but after 2 or 3 times and I assume the request is
being cached, then this happens:

# wget
Connecting to||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 36330 (35K) [text/html]
Saving to: `index.html'

Also in the first case the request is being logged in the Apache access
log, but the second one I can't even find in the access logs.
So my question is why does the rewriting work with a clean cache disk,
but doesn't if (at least I assume) data is returned from the disk cache
and why isn't there a log entry in the access log in the latter case ?

I hope someone has any ideas where I'm going wrong!


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message