Understand "hit for pass" cache objects

Justin Pasher justinp at newmediagateway.com
Mon Feb 15 23:46:17 CET 2010


Poul-Henning Kamp wrote:
> I guess you could do that, something like:
>
> 	sub vcl_fetch {
> 		set req.http.myfoo = beresp.http.set-cookie;
> 		unset beresp.http.set-cookie;
> 	}
>
> 	sub vcl_deliver {
> 		if (req.http.myfoo) {
> 			set resp.http.set-cookie = req.http.myfoo;
> 		}
> 	}
>
> But doing this means that the next user that comes without the
> cookie, will get the cached copy, and no set-cookie header ?
>   

That's actually fine (and expected). That seems to be the way Squid 
works. I actually had a similar idea myself. However, like my reply to 
Laurence, the "req" object isn't available in vcl_deliver()... or maybe 
trunk allows that? I'm currently running 2.0.6.


-- 
Justin Pasher



More information about the varnish-misc mailing list