301 not being cached

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

 



Hi Folks, 
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 the devs)

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.


--


[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