Skip Menu |

This queue is for tickets about the Catalyst-Runtime CPAN distribution.

Report information
The Basics
Id: 24132
Status: rejected
Priority: 0/
Queue: Catalyst-Runtime

People
Owner: Nobody in particular
Requestors: chris+rt [...] chrisdolan.net
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 5.7005
Fixed in: (no value)



Subject: [WISH] redirect if missing trailing / from Catalyst root
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...).
This ticket has been open for over a year. As it isn't really a bug report, you can continue this discussion on the catalyst-dev list should you wish to pursue it.