Hi,

just stumbled across this problem in my poet setup:
comps/test/index.mc exists and can be accessed via this two URLS:
http://example.com/test/ 
http://example.com/test

The first one is planned: all relative URLs in index.mc work.
The second one is unplanned, the relative URLs from index.mc won't work.
My former setup was apache based, so I expected the implicit redirect on
directories without trailing slash.

A possible workaround could be a <base>-tag in index.mc or a detection
if we are called with or without slash.
I worked around this using a simple Plack::Middleware::Rewrite:
    enable 'Rewrite',
        rules => sub {
            if (-d $poet->comps_dir.$_) {
                if ($_ !~ qr{/$}) {
                    s{$}{/};
                    return 301;
                }
            }
            return undef
        };

Question is, whose job it is do do the redirect.
Mason when it completes the internal URL by adding a slash or the PSGI
using a rewrite like the one above?

I see the following problem having these rewrite rule in place:
component /test.mc and /test/index.mc
The check has to verify first that there is no component having the name
of the directory (with 2 or 3 possible file-extensions) otherwise
the /test.mc will never be called.
So for this Mason (with its flexibility of changing index components
names) might be the better place to do the redirect, is there any chance
to get a feature for this problem?

Regards,
Oliver 
-- 
Oliver Paukstadt <pst...@sourcentral.org>

-- 
Oliver Paukstadt <pst...@sourcentral.org>


------------------------------------------------------------------------------
Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
and much more. Keep your Java skills current with LearnJavaNow -
200+ hours of step-by-step video tutorials by Java experts.
SALE $49.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122612 
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to