Caching cookies with Varnish 4

Raymond Gonzalez raygo22 at
Wed May 13 23:34:37 CEST 2015

Hi Thomas. Thanks for that. No, I'm very new at working with varnish (1 day old) so don't really know how to do what you are telling me. Could you please let me know what I should put or where can I find a tutorial to do this? A lot of what I've found online is not for V4 so it's not working. Thanks!

> On May 13, 2015, at 5:30 PM, Thomas Lecomte <thomas.lecomte at> wrote:
>> On Wed, May 13, 2015 at 5:33 PM, Raymond Gonzalez <raygo22 at> wrote:
>> I want to be able to cache pages that have a cookie. Let's say I have a
>> cookie called "testcookie" that I set up with php.
>> [...]
>> Any idea? Thanks!
> Hello Raymond,
> Since your VCL code doesn't return anything itself, the default VCL
> implementation is run after your own.
> The default vcl_recv subroutine will return (pass) if req.http.Cookie
> is present, which is the first reason why your page isn't going to be
> cached (in fact, it won't even be looked up).
> Also, in vcl_backend_response, the returned object won't be cached if
> it contains a Set-Cookie HTTP header.
> You might want to take care of these cases yourself if you want to
> cache those kind of pages, instead of leaving it to the default VCL
> implementation.
> Regards,
> -- 
> Thomas Lecomte

More information about the varnish-misc mailing list