When setting a cookie, the old ones are lost

Cornel Vaideanu Cornel.Vaideanu at greppysystems.com
Thu Aug 30 10:13:58 CEST 2012

  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


On Thu, Aug 30, 2012 at 9:00 AM, Cornel Vaideanu <Cornel.Vaideanu at greppysystems.com<mailto: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 Buer
Phone: +47 21 98 92 61 / Mobile: +47 958 39 117 / Skype: per.buer
Varnish makes websites fly!
Whitepapers<http://www.varnish-software.com/whitepapers> | Video<http://www.youtube.com/watch?v=x7t2Sp174eI> | Twitter<https://twitter.com/varnishsoftware>

Cornel Vaideanu
PHP Developer


17-19A, Ploiesti Street,
Cluj-Napoca, Romania
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20120830/eeb0e832/attachment.html>

More information about the varnish-misc mailing list