【发布时间】:2014-04-24 07:49:16
【问题描述】:
我为我的 Mojolicious 应用程序定义了几条路线和一条包罗万象的 404 路线:
$r->any('*')->to(cb => sub {
my $self = shift;
$self->render(text => '404 Not Found');
$self->rendered(404);
});
404 路由工作正常:
$ ./bin/myapp.pl -m production get /no_such_url
404 Not Found
但我也希望 404 路由匹配网站根目录,而且我总是得到一些默认的 Mojolicious 404,即使在生产模式下也是如此:
$ ./bin/myapp.pl -m production get /
<!DOCTYPE html>
<html>
<head><title>Page not found</title></head>
…
我需要做什么才能在/ 上提供我的普通 404 回调?
【问题讨论】:
标签: perl url-routing mojolicious