Caching for some cookies?

Albert Tollkuçi albert.tollkuci at
Thu Sep 1 11:57:53 CEST 2016

I've started using Varnish a few months ago and my vcl files has started to
get complicated. I'm serving 5 different sites with the same varnish
instance (using different backends) and this part is working.

Now I have some cases that for some sites I need to keep some cookies and
cache different versions based on them. Basic scenario is to show the user
a message only the first time he sees the page. Without varnish if the
cookie is not there I set it and show the message. Next time the cookie is
there and no message is shown.

With varnish my logic is to include the cookie in hash and cache two
different versions. The challenge is to make sure cookies are set correctly
and here I'm kind of stack. I've added some debug messages in my vcl and
for some reason I'm not seeing the cookies I set in my server in
vcl_backend_response. Inside the routine, I have the following code in the

       # AT: DEBUG
       if(bereq.http.x-at-debug == "1") {
         std.log("AT DEBUG - bereq URL: " + bereq.url + ". Cookies: '" +
bereq.http.Cookie + "'");
         std.log("AT DEBUG - beresp set-cookie: '" +
 beresp.http.set-cookie + "'");

I set x-at-debug header in vcl_recv based on my IP, so I can track only my
requests. In the server side I see the cookie "__IKUB_AL_Myikub_PopUp"
being set, but in vcl_backend_response is not.

Is there anything in between that can strip the cookie?

Thank you,

Follow me on: LinkedIn <> Google+
<> Facebook
<> Twitter
<> Career 2.0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the varnish-misc mailing list