When setting a cookie, the old ones are lost
Cornel Vaideanu
Cornel.Vaideanu at greppysystems.com
Thu Aug 30 09:00:33 CEST 2012
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:
[http://greppysystems.com/ftp/logo.png]
17-19A, Ploiesti Street,
Cluj-Napoca, Romania
www.greppysystems.com<http://greppysystems.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20120830/45aef40d/attachment.html>
More information about the varnish-misc
mailing list