[Catalyst] Session unexpectedly expiring

Jeff Chimene jchimene at gmail.com
Mon May 21 16:52:16 GMT 2007


Jeff Chimene wrote:
> Hi,
>
> I'm trying to figure out why my sessions are expiring in
> script/xxx_cgi.pl but not script/xxx_server.pl
> The desired cycle is to login then redirect to another controller.
>
> When I run the standalone server, the session state is recovered, and
> control resumes with the next controller.
>
> When I run using Apache & the script/xxx_cgi.pl, the session state is
> marked expired and control returns to the login controller.
>
> I'm using the Session, Session::Store::FastMmap, Session::State::Cookie
> plugins.
>
> Thanks for your support!
>
> Cheers,
> jec
This has something to do w/ the implementation of the "auto" method in
Root.pm

There's some "extra" stuff I added to support returning to the requested
URI after
login. Nevertheless, it works from script/aic_server.pl, but not from
Apache.

Anyway, I disabled the routine and received goodness from Apache.

sub auto : Private
  {
    my ($self, $c) = @_;

    if ($c->controller eq $c->controller('Login')) {
      return 1;
    }

    # If a user doesn't exist, force login
    $c->session->{after_login} = '';
    if (!$c->user_exists) {
      $c->log->debug('***Root::auto User not found, forwarding to
/login') if $c->debug;

      # make sure we return here after a successful login
      $c->session->{after_login} = $c->request->uri() unless
($c->request->uri() eq $c->request->base());
      $c->detach('aic::Controller::Login', 'index');
    }

    # User found, so return 1 to continue with processing after this 'auto'
    return 1;
  }




More information about the Catalyst mailing list