Issue related to ajax requests causing session logout - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Issue related to ajax requests causing session logout (/showthread.php?tid=62116) |
Issue related to ajax requests causing session logout - satej - 06-11-2015 In my current application, I am making a lot of ajax requests to the backend. Codeigniter version being used is 2.1.4. So after a time the session logs out, I think due to session changing and an ajax request still making request using the past token. With codeigniiter version 2.2.1, I see a fix for "Fixed a bug in the Session Library where session ID regeneration occurred during AJAX requests.". Since I have a expiration time of 2 hours and I have a single js page application with no page reload, with version 2.2.1 do I need to make a ajax request to change the token in background every 2 hour while no other ajax requests are happening. Thanks. RE: Issue related to ajax requests causing session logout - mwhitney - 06-11-2015 First, there are a number of reasons for upgrading from 2.1.4 to 2.2.2, even if it doesn't fix your current issue. As far as I can tell, the bug fix you're referencing can be found here: https://github.com/bcit-ci/CodeIgniter/commit/3ce60fcfd0c4f9e85d483beeee732eb181e6f4f0 Whether the "fix" will help or not, I don't know. You might be better off looking into what it would take to move to CI 3. RE: Issue related to ajax requests causing session logout - satej - 06-11-2015 (06-11-2015, 12:41 PM)mwhitney Wrote: First, there are a number of reasons for upgrading from 2.1.4 to 2.2.2, even if it doesn't fix your current issue. As far as I can tell, the bug fix you're referencing can be found here: https://github.com/bcit-ci/CodeIgniter/commit/3ce60fcfd0c4f9e85d483beeee732eb181e6f4f0 Thanks. yes, I was referring to the same fix changelog. So, if I use this and I have an expiration time of 2 hours and my applications is based on a single page where only ajax requests happen and I do not want the session to timeout after 2 hours. So I think to do so I need to make a special ajax request to update session once before 2 hour expiration takes place. Please let me know your thoughts on this. RE: Issue related to ajax requests causing session logout - mwhitney - 06-15-2015 If I'm reading the "fix" correctly, you would need to make a non-AJAX request to update the session, or configure an AJAX request to not be detected as an AJAX request... RE: Issue related to ajax requests causing session logout - satej - 06-15-2015 Ok. Thanks whitney. |