httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Bailleul <Emmanuel.Baill...@telindus.fr>
Subject [users@httpd] RE: Apache reverse proxy / mod_rewrite behaviour
Date Mon, 01 Feb 2010 09:01:46 GMT
> -----Message d'origine-----
> De : Raymond Zeilstra [mailto:Raymond@wannahaves.nl]
> Envoyé : vendredi 29 janvier 2010 10:49
> À : users@httpd.apache.org
> Objet : [users@httpd] Apache reverse proxy / mod_rewrite behaviour
> 
> 
> 
> Hello,
> 
> 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:
> 
> <Virtualhost 1.2.3.4:80>
> 
> 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 ^(.*)$ http://www.domain.com/$1 [L]
> 
> LogFormat "%{X-Forwarded-For}i %{Host}i %l %u %t \"%r\" %>s %b
> \"%{Referer}i\" \"%{User-Agent}i\" %D"
> TransferLog /apache/logs/www.domain.com.access.log
> ErrorLog /apache/logs/www.domain.com.error.log
> 
> 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 /cachedisk
> CacheEnable disk /
> CacheMaxFileSize 10000000
> CacheDirLevels 5
> CacheDirLength 1
> CacheDisable www.domain.com
> 
> </Virtualhost>
> 
> Now a wget gives me the following result with an empty disk cache:
> 
> # 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
> ...
> 
> This is what I want, but after 2 or 3 times and I assume the request is
> being cached, then this happens:
> 
> # 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'
> 
> 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!
> 
> Thanks,
> Raymond
> 

Maybe : http://httpd.apache.org/docs/2.2/caching.html#overview

(...)
This means that any other stages that might ordinarily happen in the process of serving a
request -- for example being handled by mod_proxy, or mod_rewrite -- won't happen. But then
this is the point of caching content in the first place.
(...)

Emmanuel

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message