0

We've been running into a cookie overflow issue, the cause is when a user creates a long query and then devise stores their location in the session, which is so long it causes a session overflow.

Rather than just resorting to clipping the stored location when it's too arbitrarily long, I'd like to see if there's other useless data I could clear but I'm not sure what part of session is actually written to the user's session cookie.

I've tried searching for this information but I just get back articles on the rails session itself, or about session's and so forth.

Which parts of the session object is actually written to the end user's session cookie?

Thermatix
  • 2,757
  • 21
  • 51

1 Answers1

0

The answer is to pull out the raw session cookie string and check if it's bytesize is greater then 4098(4kb) like this:

session.instance_variable_get(:@req).instance_variable_get(:@env)['rack.request.cookie_hash']['_*app_name*_session'].bytesize > 4098
Thermatix
  • 2,757
  • 21
  • 51