httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Houser, Rick" <>
Subject RE: rewrite before caching?
Date Thu, 19 Mar 2009 20:26:06 GMT
Sounds like a badly broken application to me.  If the data is truly
cacheable, the application shouldn't be taking explicit steps to try to
prevent just that.  Depending on what the backend system is, you might
be better off using some kind of a filter to just remove that killCache
parameter in the body text before it gets to the client.  Then, you
don't have to worry about it at all.


Rick Houser
Auto-Owners Insurance
Systems Support

-----Original Message-----
From: Anthony J. Biacco [] 
Sent: Thursday, March 19, 2009 3:36 PM
Subject: rewrite before caching?

I posted this on the users list, but didn't get any help, so I'm hoping
the dev people here can either help or at least explain if what I'm
seeing below is how it's meant to work..

I have a uri with cachebusting in it that looks like this:
where x is a unix timestamp used to make sure the url isn't cached by
the browser.

Now though I want to use apache disk caching on this url. Obviously with
the killCache parameters always changing though, this is futile. And I
can't ignore the query string with CacheIgnoreQueryString because
parameter1 and parameter2 are important to the output to the end-user,
so the cache would be inconsistent if I had caching ignore the query

So I decided to rewrite the url to remove the killCache parameter, and
while this rule itself works fine (I'm rewriting to a path not a full
url), it seems the cache check is done before the rewrite.

My rule is:

RewriteCond %{QUERY_STRING}
RewriteRule ^/path /path?parameter1=%2&parameter2=%3 [L]

And in the log I see:

 [Wed Mar 18 12:02:47 2009] [debug] mod_cache.c(131): Adding CACHE_SAVE
filter for /path [Wed Mar 18 12:02:47 2009] [debug] mod_cache.c(138):
Adding CACHE_REMOVE_URL filter for /path [Wed Mar 18 12:02:47 2009]
[debug] mod_headers.c(740): headers:
mod_cache.c(639): cache: Caching url:
[Wed Mar 18 12:02:47 2009] [debug] mod_cache.c(645): cache: Removing
[Wed Mar 18 12:02:47 2009] [debug] mod_disk_cache.c(962): disk_cache:
Stored headers for URL
[Wed Mar 18 12:02:47 2009] [debug] mod_disk_cache.c(1051): disk_cache:
Body for URL http://myhost/path?killCache=x&parameter1=y&parameter2=z

And I get a different cache file stored for every value of the parameter

Anybody know a way to get the rewriterule processed before the cache
mechanism? I can rewrite to a full url and the new request will then
pull from cache, but that induces an extra request and an extra log
entry, which I'd like to avoid if at all possible.


Manager, IT Operations
Format Dynamics, Inc.

View raw message