Varnish to cache accordingly by inspecting Backend response header

Lasse Karstensen lkarsten at varnish-software.com
Tue Mar 12 12:47:09 CET 2013


On Tue, Mar 12, 2013 at 07:38:44PM +0800, Kelvin Loke wrote:
> I was wondering if it's possible to let Varnish to cache based on Backend
> server response header?
> For example, if Backend response header has "cache_ttl = 60", then Varnish
> will cache it for 60 seconds.

This is the default behaviour, except that the header is named Cache-Control:
max-age=NN.

> If the cache_ttl = 0 or is not exist in Backend, Varnish will not cache for
> that object at all.

If an object doesn't exist, the default behaviour is to cache the 404 for
120 seconds. If you want to change that, you can set beresp.ttl in vcl_fetch.


-- 
With regards,
Lasse Karstensen
Varnish Software AS



More information about the varnish-misc mailing list