Multiple Set-Cookie Headers

Kenny Deckers kennyds at ac-systems.com
Mon Nov 14 12:19:52 CET 2011


  Hi,

Sorry that I did not elaborate this enough. Let me get into details:

We are running a magento web shop with a varnish layer in front of it on 
a separate server. At some point, the applications has to tell Varnish 
that it cannot use cached content, this happens by the setting the 
following header:

|Set-Cookie: EXTERNAL_NO_CACHE=1; expires=Thu, 10-Nov-2011 15:49:57 GMT; path=/; domain=XXXXXXXXX; httponly

*In the default.vcl the following happens the following in the sub vcl_fetch method:*

if (beresp.http.Set-Cookie ~ "NO_CACHE=") {
   return (pass)
}

Since there are multiple set-cookie headers, varnish will only be able to analyze the first Set-Cookie header.
This means that if-condition above fails and that it will not return a "pass" causing the application to serve cached content while it shouldn't.

I have compiled|the header vmod|  and imported it at the top of default.vcl. (import header;)

And I replaced the following:|
|
if (beresp.http.Set-Cookie ~ "NO_CACHE=") {|

with:

header.copy(beresp.http.Set-Cookie, beresp.http.X-Old-Cookie);
|if (beresp.http.X-Old-Cookie ~ "NO_CACHE=") {|

This still did not fix the issue.

Thanks for responding so quickly, if there is anything else we need to let you know, please tell us.

Awaiting your reply.

Kind regards,
Kenny
|
|




On 11/14/2011 11:58 AM, Kristian Lyngstol wrote:
> Hi,
>
> On Mon, Nov 14, 2011 at 09:42:59AM +0100, Kenny Deckers wrote:
>> I'm having the following issue with "multiple set-cookie headers":
> (...)
>
> What issue? You are not saying anything about what you wan to
> accomplish.
>
> Your web server sends multiple set-cookie headers. I assume you entered
> the stars yourself.
>
> What are you trying to accomplish, and what have you actually tried with
> the header vmod?
>
> - Kristian
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visithttp://www.messagelabs.com/email
> ______________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20111114/98f38c02/attachment-0003.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 25873 bytes
Desc: not available
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20111114/98f38c02/attachment-0003.jpe>


More information about the varnish-misc mailing list