[Catalyst] Weird problem with Catalyst::Authentication, and redirects

Ben van Staveren benvanstaveren at gmail.com
Wed Jan 26 11:18:00 GMT 2011

Hi Denny & list,

> Have you tried turning it off and then on again?  ;)
Repeatedly :)

> More seriously, I have found on multiple occasions that the Catalyst
> Auth stuff can seem to get itself into an inconsistent state, such that
> it starts behaving oddly (usually mine will successfully log in, but
> fail to keep track of that fact), and the only way to fix it is to
> delete the contents of the session store (database, in my case), delete
> all the cookies for the site, and possibly wipe the browser cache too.
> Other than that I'm not sure what to suggest.  Where does the auto
> return to?  Is it possible it's coming back from there to before the
> dashboard redirect, and so the redirect URL is getting overwritten
> before the output is constructed?  (I've not used auto, so no idea if
> this is a stupid question or not.)
On the off-hand of being wrong, as far as I know, auto is called before 
anything else is really done, so your dispatch chain ends up going

auto -> action -> end

I think. Anyways, I did clear the session store, zapped all the cookies, and 
the behaviour's still there. I did some Data::Dumper action, and even after 
the RenderView action class had it's way with things, the status is still set 
to 302, a Location header is present in the output, but it did render the 
template that it's not supposed to render.

Even if I do a "$c->detach('end') and return 0", it will render a template, 
which by all accounts, it's not supposed to be doing.

Doing a telnet to the dev server and querying it does return the proper 
headers for a redirect as well; Status: 302 and Location: /login - but it also 
renders the output body, for some really freaky reason.

The main issue for me is that this behaviour seems to be triggered by 
something I did in controller code somewhere, but I could swear up and down 
that I haven't done anything that touches even remotely near authentication or 
the Auth guts, so I'm totally and utterly stumped. And it's kind of important 
this works, deadlines and such things :(


Ben van Staveren
phone: +62 81 70777529
email: benvanstaveren at gmail.com

More information about the Catalyst mailing list