On Wed, May 11, 2011 at 9:49 AM, Damon Green <damon...@gmail.com> wrote:
> 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 > Tomcat. > > To test this Ive created a rewrite rule in the Apache conf: > > RewriteRule ^/damon/(.*) http://www.slashdot.org [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. > > > > http://httpd.apache.org/docs/2.2/caching.html > > # 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. > > Regards, > Damon Green. > > > -- > WMIT Team > Financial Times > Number One, Southwark Bridge, London, SE1 9HL > Internal Extension: 0207 873 3000 Ext. 7049 > Mobile: 07929 205837 > > This bug https://issues.apache.org/bugzilla/show_bug.cgi?id=45273 <https://issues.apache.org/bugzilla/show_bug.cgi?id=45273>mentions that mod_dir might intercept CACHE_SAVE filter, so I've tried disabling mod_dir, though this has had no beneficial effect. Is there a way to force the CACHE_SAVE filter on a per response code basis? Thanks, Damon Green.