-
Notifications
You must be signed in to change notification settings - Fork 641
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
Don't send session ID cookie until sessions are actually used #1765
Comments
seems good thinking as an alternative approach to the original problem. But doesn't the CSRF token change per session, so that it would have the same effect of cache breaking? Maybe that also could be tamed to only show up if there is a form? |
We block that one too. But that's not the point -- that one should also only be sent once needed, like when a form is rendered. |
in fact, it looks like the csrf cookie could potentially be even worse as a problem, if perhaps not with Craft...see discussion here. out of order with your comment, cross-posting. And yes, to your comment, just not verified that's what Craft actually does pre response to this item.... |
Sure. The issue is with both. I care more about the session one, since our site doesn't use any Craft forms (except presumably in the admin panel), and it's the authentication status which is breaking things for us. But yes, ideally neither would be sent until necessary. |
This has been a known issue in Craft 2 for ages that's just been impractical to fix. We kept it in mind developing Craft 3, though and after this fix it's working as expected again. |
In Craft 2, is there any reason for the session to be started and the
CraftSessionId
cookie to be sent to the user before application code uses the session in any way or the user logs in?CSRF, perhaps, but I noticed there's a separate cookie
YII_CSRF_TOKEN
for that, so I guess that can't be it.The cookie is being set for any user visiting the site, even if they're not logged in. If that weren't the case, pages would be more cacheable for anonymous users, and the issue described in #1758 would be moot since I wouldn't have to have the caching proxy filter out this cookie on non-admin pages.
The text was updated successfully, but these errors were encountered: