mod_disk_cache and mod_rewrite

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi.

We are using a combination of mod_disk_cache and mod_rewrite in front of our portal to achieve setup where

1) Logged in administration users see live uncached view of the site
2) Normal users see a version served from the Apache (2.2.3) cache (120 sec delay)

The problem is that mod_rewrite and mod_disk_cache don't appear to well together and mod_disk_cache seems to ignore all that mod_rewrite does.

We are using rewrite rule

RewriteCond %{HTTP_COOKIE} ^(.*?;\s+)?LOGIN=
RewriteRule (.*) /no-cache$1 [PT]

which rewrites all requests which include LOGIN-cookie (admin users) to "/no-cache" and

ProxyPass /no-cache/ ajp://localhost:8009/

to proxy the request over AJP to Tomcat.

Then we are using cache settings which ignore all cache related headers and forces requests to be servers from the cache.

CacheDefaultExpire 120
CacheMaxExpire 120
CacheIgnoreCacheControl on
CacheIgnoreNoLastMod on
CacheIgnoreHeaders Set-Cookie, Last-Modified, Cache-Control
CacheRoot /var/cache/mod_proxy
CacheDirLevels 5
CacheDirLength 3
CacheDisable /no-cache
CacheEnable disk /web/guest/home
CacheEnable disk /image/journal/article
CacheEnable disk /c/portal/css_cached
CacheEnable disk /c/portal/javascript_cached

The problem is that even though rewrite rule seems to work, mod_cache seems to use the original unrewritten path and everything is cached.

The following log seems to suggest that mod_deflate sees the rewritten path but mod_cache uses to original unrewritten path.

[Fri Oct 05 10:45:48 2007] [debug] mod_deflate.c(447): [client 192.168.18.212] Zlib: Compressed 11716 to 11674 : URL /no-cache/image/journal/article, referer: http://kala20.host.com/web/guest/home [Fri Oct 05 10:45:48 2007] [debug] mod_headers.c(612): headers: ap_headers_output_filter() [Fri Oct 05 10:45:48 2007] [debug] mod_cache.c(502): cache: /image/journal/article?img_id=16905 not cached. Reason: Query string present but no expires header


rewrite.log

192.168.18.212 - - [05/Oct/2007:10:45:20 +0300] [kala20.host.com/sid#8c51d48][rid#8e72ea8/initial] (2) rewrite '/web/guest/home' -> '/no-cache/web/guest/home' 192.168.18.212 - - [05/Oct/2007:10:45:20 +0300] [kala20.host.com/sid#8c51d48][rid#8e72ea8/initial] (2) forcing '/no-cache/web/guest/home' to get passed through to next API URI-to-filename handler


Is this a viable approach? Is there any other possible solutions for achieving the this setup.

* Janne Kario





---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux