hit for pass problems (was: Problems getting Varnish to cache certain things)

Darryl Dixon - Winterhouse Consulting darryl.dixon at winterhouseconsulting.com
Wed Jun 24 22:42:33 CEST 2009

> Hi,
> On Wed, Jun 17, 2009 at 08:32:07PM +0000, Poul-Henning Kamp wrote:
>>>> Only pass in vcl_fetch will create a "hit for pass" object.
>>>Hrm. When did this change? We tested and confirmed in 2.0.3(?) that
>>>pass'ing out of vcl_hit caused the hit-for-pass behaviour.
>> The object will not be marked as hit-for-pass if you do that, but
>> the resulting behaviour is the same, so unless you inspect stats,
>> you cannot tell the difference.
> I am trying to set ttl before doing pass in vcl_fetch, at all places in
> vcl_fetch where I do pass. Like for example:
>         if (!beresp.cacheable) {
>                 set beresp.ttl = 1200s;
>                 pass;
>         }
> But still, it happens that Varnish will not cache objects, unless I
> restart it (I waited more than the above TTL value).

The problem is the call to 'pass'. You must not do this in vcl_fetch if
you want Varnish to be able to cache the item. Instead, restart the
request with 'restart'.

Darryl Dixon
Winterhouse Consulting Ltd

More information about the varnish-misc mailing list