httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damon Green <>
Subject mod_cache not caching 301s
Date Wed, 11 May 2011 08:49:16 GMT
Hi Folks, I posted this question on users but haven't had any joy there,
hoping someone here may know more.

I have an issue with mod_cache, it refuses to cache redirects (301) and
insists on cacheing 404 error responses, so really two issues.

I'm using Apache 2.2.17 and the mod_cache/mod_disk_cache from Apache 2.3
which serves stale content from its disk cache when the Tomcat is
unavailable. (patched version from Graham Leggett)

Trawling the list archives and docos imply that 404 responses should not be
cached, and that 30x responses should be, but the behaviour I'm seeing is
the opposite of that.

I need 301 redirects to remain working (from the cache) when we disable

To test this Ive created a rewrite rule in the Apache conf:

RewriteRule ^/damon/(.*) [R=301,L]

Then cleared the cache, hit a page in /damon/, got redirected, nothing
created in the disk cache.
any 200 or 404 however creates files in the cache.

# The response must have a HTTP status code of 200, 203, 300, 301 or 410.

This is largely a function 13.4 in the RFC:

   A response received with a status code of 200, 203, 206, 300, 301 or
   410 MAY be stored by a cache and used in reply to a subsequent
   request, subject to the expiration mechanism, unless a cache-control
   directive prohibits caching. However, a cache that does not support
   the Range and Content-Range headers MUST NOT cache 206 (Partial
   Content) responses.

Any advice or ideas gratefully received.

Damon Green.

Financial Times
Number One, Southwark Bridge, London, SE1 9HL
Internal Extension: 0207 873 3000 Ext. 7049
Mobile: 07929 205837

View raw message