[dancer-users] Should get '/projects/' => also handle /projects redirecting to /projects/

Warren Young wyml at etr-usa.com
Tue Feb 3 22:50:20 GMT 2015


> On Feb 3, 2015, at 5:52 AM, Gabor Szabo <gabor at szabgab.com> wrote:
> 
> I wonder if Dancer2 should have similar behavior, without the blowing up part?

In v1 at least, Dancer treats a URL with a trailing slash as different from one that lacks a trailing slash.  If you want Dancer to respond to both, you either have to define a route handler for each separately, or you have to resort to trickery:

    https://www.mail-archive.com/dancer-users@dancer.pm/msg01115.html

This is broken, IMHO, as it violates the expectations of anyone coming from a world where URL components are matched the same way as static files.  That is to say:

    http://example.com/foo

and

    http://example.com/foo/

will both serve $DocumentRoot/foo/index.{html,php,asp,whatever}.


More information about the dancer-users mailing list