Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter4 - xhr/ajax request refreshing session expire time
#1

Hello,

I have problem with session expire parameter, when sending Ajax to server expire time is refreshed - so session never expire.
Like screen (look at 'expires' parameter of cookie):

[Image: qnMRbQk.png]
Reply
#2

See HTTP incoming request isAjax();

Also you should do a session write close before executing Ajax.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(This post was last modified: 06-15-2018, 04:30 AM by Przem4S.)

Hi,

Yes, isAjax() returns true.

In steps:

1. I create session in BaseController.
2. Display some view with jQuery.
3. This view sends Ajax in 10 secs interval.
4. Effect = every interval runs \CodeIgniter\Session\Session->setCookie method and then rewrite expiration time with new (mayby this is bug?).

Now I find solution for this, override this method by own:
[Image: eZ69hkn.png]
Reply
#4

If it is a bug then I would report it on GitHub.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

(This post was last modified: 06-15-2018, 12:00 PM by Przem4S.)

Yes, I think it is, it should be checking current session expire time and set it or not changing session cookie, other cookie functionality work fine, but expire time refreshing.

EDIT: Report on github created.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB