CookieOverflow with small session in rails
I'm having a problem with a rails application. I've searched google and stack overflow for some time now and couldn't find something similar to my specific case.
The problem is CookieOverflow. Ok, there are a lot of topics on this subject, but all of them go along Person 1 : "I'm having cookie overflow!" Person 2 : "Your session, which is stored in a cookie, may be too big. The maximum size allowed is 4k. Use AR sessions if it really needs to be this big" Person 1 : "I checked my session and it's really huge with full active record objects stored, problem solved!"
Well... the difference in my case is that my session REALLY doesn't seem to be big at all. I get the CookieOverflow whenever i redirect to my home page from a certain page with an error message to be flashed.
The session dump has this format:
>_csrf_token: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
>flash: {:alert=>{:body=>["is too long (maximum is 400 characters)"]}}
>invitation_token:开发者_开发问答 "aaaaaaaaaaaaaaaaaaaa"
>session_id: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
>warden.user.user.key: ["User", [4], "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"]
EDIT: A bit of extra info: What makes this problem all the weirder is the fact that other controllers/actions also send the user back to the home with errors to be flashed. Some of them with way longer errors to be shown, and they all work.
Well... the difference in my case is that my session REALLY doesn't seem to be big at all. I get the CookieOverflow whenever i redirect to my home page from a certain page with an error message to be flashed
Flash messages are stored in the session. Your flash message you are showing on redirect is too big! Shorten your flash message and the issue should be solved. I had to debug this problem myself a couple of months ago.
If you still doubt if this is the issue, please add to your post your flash message logic for this redirect.
精彩评论