【问题标题】:Processing paths that start with a dot using Mason dhandler使用 Mason dhandler 处理以点开头的路径
【发布时间】:2019-03-29 09:19:02
【问题描述】:

如何让 Mason dhandler 处理路径部分以 . 开头的 URL?

例如,如果我的 Web 根目录中有一个 dhandler 文件,则在我导航到时会触发 dhandler

`http://www.example.com/hello`

但如果我导航到 http://www.example.com/.hello,我会得到 404。

我将MasonApache 结合使用,并且我已验证这不是Apache 配置问题,禁止以点开头的路径。

【问题讨论】:

    标签: apache perl mason


    【解决方案1】:

    你可能是指HTML::Mason,而不是新的(呃)Mason

    虽然我没有安装 Apache,但使用 HTML::Mason::PSGIHandler 创建 PSGI 测试用例很简单,例如 app.psgi

    use 5.014;
    use warnings;
    use HTML::Mason::PSGIHandler;
    
    my $h = HTML::Mason::PSGIHandler->new(
        comp_root => $ENV{HOME}.'/tmp/mas/comps',
    );
    
    my $app = sub {
        my $env = shift;
        $h->handle_psgi($env);
    };
    

    还有一个非常简单的dhandler

    <pre>
    =<% $m->dhandler_arg %>=
    </pre>
    

    在运行plackup 并将我的浏览器指向http://localhost:5000/.hello 后,它会显示

    所以,HTML::Mason 没有对带点的处理路径有任何限制。

    如果您需要更多帮助,请编辑您的问题并添加您的 apache 配置、htaccess 和您的处理程序的相关部分,您如何调用 HTML::Mason

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-02-20
      • 1970-01-01
      • 2016-02-06
      • 1970-01-01
      • 2020-10-10
      • 1970-01-01
      • 2017-06-09
      • 1970-01-01
      相关资源
      最近更新 更多