How to make Varnish not caching response if they do not have proper cache header?

Jonathan Matthews contact at jpluscplusm.com
Mon Mar 26 13:10:10 CEST 2012


On 26 March 2012 11:55, Ryan Chan <ryanchan404 at gmail.com> wrote:
> On Sun, Mar 25, 2012 at 6:10 PM, Jonathan Matthews <contact at jpluscplusm.com>
> wrote:
>>
>> On 25 March 2012 05:15, Ryan Chan <ryanchan404 at gmail.com> 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.

I can't disagree with you there, personally :-)
I always drop this to 0s so I can insist that the back-end devs
request caching be enabled by explicitly setting the appropriate
headers.

> 2. I am using 2.1, so sound like hard coding the ttl is the best choice
> then?

You'll find the 2.1 documentation is still available on the site. In
some ways it's actually a bit easier to find your way around than the
current 3.0 docs. *Most* 3.0 functionality is available in 2.1.
default_ttl definitely is, however.

Jonathan
--
Jonathan Matthews
London, Oxford, UK
http://www.jpluscplusm.com/contact.html



More information about the varnish-misc mailing list