This project is archived and is in readonly mode.
ActionController::Flash::InstanceMethods::flash triggers the lazy sessions
-
runa
- Tag set to 2.3.2, flash, lazy, sessions
-
Stefan Botzenhart
Any comments on this ticket? I realized the same thing when trying to cache my application with varnish. As flash triggers the session and sets the "Set-Cookie" header although the session is empty varnish is not willing to cache the page.
-
runa
Maybe we need to lobby a little for this?
-
Urban Hafner
- Tag changed from 2.3.2, flash, lazy, sessions to 2.3.2, 2.3.x, flash, lazy, sessions
Check out this plugin: http://github.com/msales/smart_cookie_store
It enhances the default
CookieStoreby preventingSet-Cookieheaders for empty sessions. -
Jeremy Kemper
- Milestone changed from 2.x to 2.3.6
- State changed from new to open
- Assigned user set to josh
-
Urban Hafner
It is related. How did you fix it? The fix for #3811 Empty Set-Cookie header isn't enough.
-
Urban Hafner
- Tag changed from 2.3.2, 2.3.x, flash, lazy, sessions to 2-3-stable, 2.3.2, 2.3.x, 3, 3.0, flash, lazy, sessions
I had a look and it's not fixed in the latest 2-3-stable. Attached is a diff that contains a test and possible fix (but the fix breaks the reset session functionality). To recap, the problem is that even when you only try to access something in the session (like for example a
flash[:notice]in the layout) a session cookie gets set. Even if it is empty and there's no need for it.I'm not quite sure about Rails 3, but the bug seems to be present there, too.
-
Urban Hafner
BTW, sorry for the typo in the test case ;)
-
Urban Hafner
- Tag changed from 2-3-stable, 2.3.2, 2.3.x, 3, 3.0, flash, lazy, sessions to 2-3-stable, 2.3.2, 2.3.x, 3, 3.0, 3.0pre, flash, lazy, sessions
I just tested it and the bug is still present in Rails 2.3 (latest version of the branch) and in master. However in master my fix doesn't work (even after the obvious changes necessary to have a look).
-
Jeremy Kemper
- Milestone changed from 2.3.6 to 2.3.9
- State changed from resolved to open
-
José Valim
- State changed from open to duplicate
- Importance changed from to
Fixed on master. When #4938 [PATCH] Session fixes: sessions should not be created until written to; and s... is backported, this will be fixed as well.
