How to make Varnish not caching response if they do not have proper cache header?
Andreas Plesner Jacobsen
apj at mutt.dk
Mon Mar 26 13:05:15 CEST 2012
On Mon, Mar 26, 2012 at 06:55:01PM +0800, Ryan Chan wrote:
> > Your responses are probably being cached because of the default default_ttl
> > setting, which you'll find detailed a little way down
> > https://www.varnish-cache.org/docs/3.0/reference/varnishd.html#run-time-parameters
> 1. I am wondering why `default_ttl of 120s is a good thing`, if the backend
> don't specify the ttl, shouldn't just pass it and not cache it would be the
> safest option? Hard coding 120s sound evil to me.
No, since Varnish is not a cache in the RFC2616 sense. You're expected to
configure your own policy. You can easily check for header presence in VCL and
set TTL accordingly.
> 2. I am using 2.1, so sound like hard coding the ttl is the best choice
2.1 has the same default_ttl parameter. See man varnishd.
More information about the varnish-misc