Problem with pass in vcl_fetch

Connor Walls connor.walls at skillpages.com
Tue Aug 9 17:32:32 CEST 2011


Thanks for that! However, I've tried the solution given at the end (setting the TTL to a low value when passing), and it doesn't work. According to some of the comments on the page by Anders, the TTL value mightn't be honoured after a pass:

Anders Nordby	 January 11, 2010 at 3:00 pm
I had some issues with this as well. As I am running trunk, I don’t have beresp.ttl instead of obj.ttl. I’m not sure setting beresp.ttl is respected after a pass in vcl_fetch. I’ll try, as what I have been doing (restart and catch the request back in vcl_recv) is causing other headaches.

Anders Nordby	 January 11, 2010 at 3:02 pm
I wonder if default TTL is actually used, instead of beresp.ttl, if I pass in vcl_fetch? I have a long default TTL, and had serious problems controlling TTL with pass in vcl_fetch.

The change I've made in my VCL is 

sub vcl_fetch {
    if (beresp.http.X-SP-NoCache ~ "(?i)yes") {
        set beresp.ttl = 1s;
        return (pass);
    }

    //...other code
}

Could anyone shed any light on this? Is this the wrong place or wrong object for me to be setting the ttl?

Thanks,
Connor Walls

-----Original Message-----
From: Tollef Fog Heen [mailto:tfheen at varnish-software.com] 
Sent: 09 August 2011 10:54
To: Connor Walls
Cc: varnish-misc at varnish-cache.org
Subject: Re: Problem with pass in vcl_fetch

]] Connor Walls 

| The thing that’s confusing me, and that’s leading me to believe it 
| isn’t my vcl code that’s the problem, is that flushing the cache is 
| fixing the issue. I don’t understand how flushing the cache can affect 
| the behaviour of any page which isn’t currently stored in the cache?
| I’m running varnish-2.1.3 if that’s relevant. Any help would be 
| greatly appreciated.

You want to read up on hit for pass objects, see http://kristianlyng.wordpress.com/2010/01/08/hitpass-objects-and-varnish/

Regards,
--
Tollef Fog Heen
Varnish Software
t: +47 21 98 92 64


More information about the varnish-misc mailing list