Welcome Guest, Not a member yet? Register   Sign In
Issue related to ajax requests causing session logout
#1

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.
Reply
#2

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/c...b181e6f4f0

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.
Reply
#3

(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/c...b181e6f4f0

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.

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.
Reply
#4

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...
Reply
#5

Ok. Thanks whitney.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB