LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-25-2010, 09:38 AM   #1
poard
LQ Newbie
 
Registered: Jan 2010
Posts: 3

Rep: Reputation: 0
Problem rewriting Apache/GeoIP


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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache - rewriting links dlugasx Linux - Server 3 04-15-2009 06:51 AM
Apache: Need helping rewriting URLs hex1a4 Linux - Server 1 05-20-2008 09:31 AM
problem rewriting trip_points matti3 SUSE / openSUSE 3 11-13-2007 04:55 PM
problem with Mandrake 10.0 and GeoIP taz999 Linux - Newbie 2 01-13-2005 01:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration