[eluser]Unknown[/eluser]
Research: I've found a lot of posts on CodeIgniter sessions unexpectedly expiring for AJAX-based web apps, but haven't found a working solution for my specific issue.
Findings: I've narrowed it down to how
sess_time_to_update works, and here's an illustrative example. Suppose I set
sess_time_to_update to 1 minute. After the minute is up, the session ID is regenerated. This updates the database and currently set cookie. And that's where things go wrong. After the reset, the browser cookie is actually destroyed, and the user in my web app is logged off.
Confidence: I've verified that this is the cause of my sessions expiring by toggling
return immediately in the
sess_update() function. Snippet below.
Code:
/**
* Update an existing session
*
* @access public
* @return void
*/
function sess_update()
{
return;
...
Expecations: I don't wish to use native sessions, I prefer to stick with CodeIgniter sessions. If the solution works, the user would stay logged in for at least longer than the value of
sess_time_to_update.
Configurations: I'm using
sess_use_database = TRUE. My CodeIgniter version is 2.2.0.
Other notes: It's interesting that I have the same install on another web app but that one works perfectly. Honestly, I've no idea why that would be.