When setting a cookie, the old ones are lost

Paul A. Procacci pprocacci at datapipe.com
Thu Aug 30 11:01:11 CEST 2012


The problem is simply with browsers interpreting set-cookie headers
differently.

While appending '; foo=bar' _should_ work, it _will not_ work in all
browsers.

All the major browsers that I've tested have worked with sending
multiple set-cookie headers.  That's not to say it's right, but it
is to say it works _for me_.

You need to for obvious reasons test this for yourself to confirm, but
my solution has always been to add additional set-cookie headers
(which you can accompish easily with that vmod).

~Paul

On Thu, Aug 30, 2012 at 08:13:58AM +0000, Cornel Vaideanu wrote:
>    Hello
>      Thank you for the advices, in this scenario I am forced to use a
>    cookie because I want to make a 307 redirect every time varnish would
>    send 503 to borwser, but I need to send a cookie to prevent redirect
>    loops.
>    If you have any solution for this, your advice will be highly
>    appreciated.
>    I tried this way:  set resp.http.set-cookie = resp.http.set-cookie +
>    ";foo=bar"
>    but it didn't work for me.  Are you sure this method should work or I
>    am forced to use the vmod that Paul suggested ?
>    Thank you very much
>      __________________________________________________________________
>
>    From: Per Buer [perbu at varnish-software.com]
>    Sent: Thursday, August 30, 2012 10:48 AM
>    To: Cornel Vaideanu
>    Cc: varnish-misc at varnish-cache.org
>    Subject: Re: When setting a cookie, the old ones are lost
>    Hi,
>    On Thu, Aug 30, 2012 at 9:00 AM, Cornel Vaideanu
>    <[1]Cornel.Vaideanu at greppysystems.com> wrote:
>
>
>    Can you tell me how can I set a new cookie without losing the cookies
>    that apache sends ?
>
>    The problem is that there can, according to the IETF, only one
>    Set-Cookie header.  What you want to so is to modify the exsisting
>    set-cookie header.
>    Something like:
>     set resp.http.set-cookie = resp.http.set-cookie + ";foo=bar"
>    You could add another Set-Cookie header as Paul proposed but that
>    breaks the spec, all though it will probably work for at least 99% of
>    the clients out there.
>    Per.
>    --
>    [varnishsoft_white_190x47.png]
>    Per Buer
>    Phone: +47 21 98 92 61 / Mobile: +47 958 39 117 / Skype: per.buer
>    Varnish makes websites fly!
>    [2]Whitepapers | [3]Video | [4]Twitter
>
>    Cornel Vaideanu
>    PHP Developer
>    M:
>    [logo.png]
>    17-19A, Ploiesti Street,
>    Cluj-Napoca, Romania
>    [5]www.greppysystems.com
>
> References
>
>    1. mailto:Cornel.Vaideanu at greppysystems.com
>    2. http://www.varnish-software.com/whitepapers
>    3. http://www.youtube.com/watch?v=x7t2Sp174eI
>    4. https://twitter.com/varnishsoftware
>    5. http://greppysystems.com/

> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

________________________________

This message may contain confidential or privileged information. If you are not the intended recipient, please advise us immediately and delete this message. See http://www.datapipe.com/legal/email_disclaimer/ for further information on confidentiality and the risks of non-secure electronic communication. If you cannot access these links, please notify us by reply message and we will send the contents to you.



More information about the varnish-misc mailing list