Hi,
I'm using default Ubuntu server 9.01 and Apache as a reverse proxy.
For certain countries the visitors must be served a fixed url, so I use GeoIP to check the ip of the visitor and redirect accordingly.
However, as disk cache fills up it seems that the proxy server is returning a (cached ?) page before it's going through the rewrite rules.
The Apache config is like this:
<Virtualhost 1.2.3.4:80>
GeoIPEnable On
GeoIPScanProxyHeaders On
GeoIPDBFile /var/www/GeoIP.dat
RewriteEngine On
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(nl|be|de)$ [NC]
RewriteCond %{HTTP_HOST} !^(nl|be|de|www)\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L]
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /
http://127.0.0.1:8080/
ProxyPassReverse /
http://127.0.0.1:8080/
ProxyPreserveHost On
CacheRoot /cacheroot
CacheEnable disk /
CacheMaxFileSize 10000000
CacheDirLevels 5
CacheDirLength 1
CacheDisable
www.domain.com
</VirtualHost>
If I do a wget with an empty cache disk this is the result:
wget
http://nl.domain.com/
Resolving nl.domain.com... 1.2.3.4
Connecting to nl.domain.com|1.2.3.4|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location:
http://www.domain.com// [following]
Resolving
www.domain.com... 1.2.3.4
...
Looks good...
But after a few wgets it turns out to be this:
wget
http://nl.domain.com/
Resolving nl.domain.com... 1.2.3.4
Connecting to nl.domain.com|1.2.3.4|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 36330 (35K) [text/html]
Saving to: `index.html'
It does not rewrite, but seems to be served directly from the disk cache... anyone any ideas how to fix this ?
Cheers,
Poard