Cache HTTP 404 Page

Andreas Plesner Jacobsen apj at mutt.dk
Fri Apr 13 14:26:56 CEST 2012


On Fri, Apr 13, 2012 at 07:54:19PM +0800, Kelvin Loke wrote:

> >> I am not sure if this is workable, is these a way for Varnish to cache 404 page?
> >
> > Varnish will do so by default. If it doesn't, it's because you have VCL or
> > backend headers (Expires or Cache-Control) preventing the caching.
>
> Thanks Andreas, just realized that the backend server sets "Age: 0",
> this might the reason why Varnish didn't cache 404 page.

No. Age is used to provide clients an indication of how long an object has been
stored in a cache.

> By the way, if Varnish will cache 404 by default, what is the default
> TTL for this? Is there a way to set a custom TTL for 404 caching?

Same as for every other object: derived from cache-control (max-age, s-maxage),
expires or default_ttl

Please fix your quoting.

-- 
Andreas



More information about the varnish-misc mailing list