Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Mojolicious session does not expire

by Mr. Muskrat (Canon)
on Aug 09, 2017 at 16:21 UTC ( #1197116=note: print w/replies, xml ) Need Help??

in reply to Mojolicious session does not expire

First off let me say that it has been a while since I've used Mojolicious. Second you said "after the redirect, session still contains the username which was logged in" but you haven't provided any code that shows how you know this. Are you certain that the username is coming from the session and not the stash?

If you can provide a SSCCE then you'd really be helping everyone to help you solve this.

  • Comment on Re: Mojolicious session does not expire

Replies are listed 'Best First'.
Re^2: Mojolicious session does not expire
by Anonymous Monk on Aug 09, 2017 at 16:23 UTC
    There is a rather excellent chance that the page-image which shows logged in status is coming from the browser cache. Use the browser debugger to see if page content is actually being returned ... if the browser is actually requesting HTML from the network for the new page.
Re^2: Mojolicious session does not expire
by Anonymous Monk on Aug 29, 2017 at 12:39 UTC

    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.

      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.

      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
      Thanks for helping!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1197116]
[Corion]: "Unmatched ) in regex; marked by <-- HERE in m/(&#9583;&# 9633;)&#9583;&# 65077; &#9531;&#9473;&# 9531;) <-- HERE / at -e line 1." :)
[Corion]: Meh - my "flip the table" string doesn't render here ;)
[choroba]: It renders correctly in pm-cb-g
[erix]: heh
[Veltro]: is it a question?
[erix]: or a conundrum?

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2018-07-17 16:08 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (372 votes). Check out past polls.