
dbix-class at trout
May 29, 2008, 9:38 AM
Post #5 of 5
(455 views)
Permalink
|
|
Re: RT #24132: [WISH] redirect if missing trailing / from Catalyst root
[In reply to]
|
|
On Wed, May 28, 2008 at 10:46:43AM -0300, Brian Cassidy wrote: > On behalf of "CDOLAN <cpan[at]chrisdolan.net> ": > > CDOLAN <cpan[at]chrisdolan.net> > > I'm running a Catalyst app at a non-server-root location, say > http://example.com/foo/. When accessing the app root properly with the > trailing slash, Catalyst correctly processes path '/'. However, when > requesting the URL without the slash (like http://example.com/foo) > Catalyst processes path '/foo' instead of '/'. > > This is a common problem that can be solved via Apache redirect, but it > would be convenient if Catalyst could solve it by itself. I propose the > following trivial fix, but am unsure where it belongs in the code base: > > if ($c->req->uri . '/' eq $c->req->base) { > $c->req->redirect($c->req->base); > return; > } > > Perhaps this could even be a plugin that runs at the prepare_path phase? > > An incorrect solution would be to internally pretend the URL had the > slash because that would break relative URLs (but you already knew that...). Memory saith the misdispatching is generally caused by a broken webserver config. Andy (or anybody else), can you confirm or deny that? Other than that, it looks like his proposed "incorrect solution" would be the fix to an engine bug underlying this. The whole redirect thing is certainly bollocks, although for people using relative URLs it might be a useful cookbook entry to show how to do this in a :Path('') action in Root.pm or something. -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Director http://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/ _______________________________________________ Catalyst-dev mailing list Catalyst-dev[at]lists.scsys.co.uk http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev
|