I have several routes defined for my Mojolicious application and only 404 routes:
$r->any('*')->to(cb => sub {
my $self = shift;
$self->render(text => '404 Not Found');
$self->rendered(404);
});
Route 404 is working fine:
$ ./bin/myapp.pl -m production get /no_such_url
404 Not Found
But I also want route 404 to match the root of the website, and I always get the default Mojolicious 404, even in production mode:
$ ./bin/myapp.pl -m production get /
<!DOCTYPE html>
<html>
<head><title>Page not found</title></head>
…
What do I need to do to service my simple 404 callback on /?
source
share