http://qs321.pair.com?node_id=1198265


in reply to Re: Mojolicious session does not expire
in thread Mojolicious session does not expire

I know it's been a while, but we're still experiencing the same problem. The session is somehow not cleared. This code gets executed during logout:  "$self->session(expires => 1);

Then, at login, printing the session variable  say $self->session('username'); sometimes yields the username and the user remains logged in, sometimes it is undefined and the user can log out successfully. I was not able to find a pattern for this, but it doesn't fail only on the server, it also fails on localhost, so there's no connection to that.

Replies are listed 'Best First'.
Re^3: Mojolicious session does not expire
by Corion (Patriarch) on Aug 29, 2017 at 12:43 UTC

    Have you investigated whether your script sends the correct Set-Cookie headers upon logout?

    If yes, there is a problem with the browser, in that it maybe has old cookies that the program still considers valid.

    If no, investigate why the cookie headers are not sent.

Re^3: Mojolicious session does not expire
by Anonymous Monk on Aug 29, 2017 at 18:28 UTC
    I found the error, the request was made using an <a href="" onclick="do_logout()"></a>, which was basically doing 2 actions at once and creating a race condition. Here is the relevant code snippet https://ideone.com/UUeYRw
    Thanks for helping!