Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set or renew custom cookies #1540

Open
phizab opened this issue Apr 29, 2019 · 1 comment
Open

Unable to set or renew custom cookies #1540

phizab opened this issue Apr 29, 2019 · 1 comment

Comments

@phizab
Copy link

phizab commented Apr 29, 2019

Today I tried to set a custom cookie running Turpentine. Although the cookie was set in PHP-Code, it does not appear in the browser.

In the VCL I saw following code:

# if Magento sent us a Set-Cookie header, we'll put it somewhere
# else for now
if (beresp.http.Set-Cookie) {
    set beresp.http.X-Varnish-Set-Cookie = beresp.http.Set-Cookie;
    unset beresp.http.Set-Cookie;
}

If I'm right, cookies will be stripped here, but I cannot see any code for inserting them again (X-Varnish-Set-Cookie is not used anywhere).

Besides that I'm not able to set custom cookies, the default Magento cookies (e.g. "frontend") won't be renewed. So Magento cookies will expire, although the customer still is in the shop. I'm aware that cookies cannot be set on Cache-Hits, but should be on Cache-Misses e.g. cart page or in checkout. Worst case would be, if the cookie expires while checking out.

I tested this by setting cookie lifetime to 30 seconds in a local environment. I added some items to cart and clicked through the shop. 30 seconds after I added the items to my cart it was empty and the session was dropped. This only apply for 200 or 404 requests, in 30X requests cookies will be renewed.

Can anybody confirm this issue? Or does this appear only in our setting? We use form key generation in Magento, not in the VCL.

@phizab
Copy link
Author

phizab commented Apr 29, 2019

I explored another issue. beresp.http.Set-Cookie only returns the first Set-Cookie-Header, which will be stored in beresp.http.X-Varnish-Set-Cookie and all others will completely be dropped, if I'm right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant