Re: Prevent caching of 404 responses

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

 



On Thu, Feb 26, 2015 at 10:21 AM, Paul Beckett <paul_beckett@xxxxxxxxxxx> wrote:
> Is there any way to restrict what HTTP response codes are cached by Apache,
> ideally I would like to only cache 200,301,302 responses.

It is not possible to specify some particular status mod_cache would
or not cache, it is solely controlled by the relevant Cache-Control
and Expires headers.
(Note that 301 will not be cached unless "forced" by these headers).

You could use some mod_headers rule(s) like :
   Header merge Cache-Control private "expr=%{REQUEST_STATUS} == 404"
   Header merge Pragma no-cache "expr=%{REQUEST_STATUS} == 404"
to prevent mod_cache (but also other caches down the chain) from
caching eg. 404s.

Regards,
Yann.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-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