When setting a cookie, the old ones are lost
Paul A. Procacci
pprocacci at datapipe.com
Thu Aug 30 09:32:09 CEST 2012
You'll want to use the following vmod.
https://github.com/varnish/libvmod-header
~Paul
Don't On Thu, Aug 30, 2012 at 07:00:33AM +0000, Cornel Vaideanu wrote:
> Hello
> I am using Varnish 3 in in front of apache with php. I need to set
> a cookie in the browser every time the user doesn't receive a 503
> response I use the following code:
>
> if(resp.status != 503) {
> set resp.http.Set-Cookie =
> "my_error_cookie =false; expires: Session; path=/";
> }
>
> The problem is that the cookies received from apache are rewritten, if
> I use this I never receive the PHPSESSID cookie. For debug proposes I
> added this code :
>
> set resp.http.X-Cookie-Debug = "Response cookie: " +
> resp.http.Set-Cookie;
>
> if(resp.status != 503) {
>
> set resp.http.Set-Cookie = "
> my_error_cookie=false; expires: Session; path=/";
> }
>
> set resp.http.X-Cookie-Debug2 = "Response cookie2: " +
> resp.http.Set-Cookie;
>
> These are the headers that browser receives :
>
> 1. X-Cookie-Debug:
> Response cookie: PHPSESSID=egf2tthsj0fm2bmt1oircumgk6; path=/
> 2. X-Cookie-Debug2:
> Response cookie2: my_error_cookie=false; expires: Session; path=/
>
> And there is only one Set-Cookie header :
> Set-Cookie:
> my_error_cookie=false; expires: Session; path=/
>
>
> Can you tell me how can I set a new cookie without losing the cookies
> that apache sends ?
>
> Thank you very much
>
> Cornel Vaideanu
> PHP Developer
> M:
> [logo.png]
> 17-19A, Ploiesti Street,
> Cluj-Napoca, Romania
> [1]www.greppysystems.com
>
> References
>
> 1. 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