Plack::...ocument(3)
β¨ NAME β¨
Plack::Middleware::ErrorDocument β it's giving "pick your own error page per HTTP status code" π
Oh and btw bestie, this is from the User Contributed Perl Documentation manual, page Plack::...ocument(3) β yes the name is literally abbreviated like that, she's mysterious, she's iconic, we love her π
πΈ SYNOPSIS πΈ
# in app.psgi
use Plack::Builder;
builder {
enable "Plack::Middleware::ErrorDocument",
500 => '/uri/errors/500.html', 404 => '/uri/errors/404.html',
subrequest => 1;
$app;
};
π DESCRIPTION π
okay so <pink>Plack::Middleware::ErrorDocument</pink> lets you customize your error screen, no cap β you just hand it paths (either a file system path OR a URI path, dealer's choice π¦) for error pages, matched up per status code. Obsessed.
π§ CONFIGURATIONS π§
π subrequest
A boolean flag, bestie β it says whether to serve error pages using a brand new GET sub request. Defaults to false, which means it serves error pages using the file system path instead. π
builder {
enable "Plack::Middleware::ErrorDocument",
502 => '/home/www/htdocs/errors/maint.html';
enable "Plack::Middleware::ErrorDocument",
404 => '/static/404.html', 403 => '/static/403.html', subrequest => 1;
$app;
};
So this config serves 502 error pages straight from the file system, assuming that's when you're probably maintaining a database and stuff (it's giving maintenance era π), BUT it serves the 404 and 403 pages using a sub request so your application can do some logic in there β like logging, or dropping suggestions. Main character behaviour fr fr.
β Ngl, super important: when you're using a subrequest, the subrequest should return a regular '200' response. Periodt.
π AUTHOR π
Tatsuhiko Miyagawa β the icon, the legend π
π₯ SEE ALSO π₯
gonna be honest bestie, there's nothing else listed here π it's just this page, and she ate.
slay, that's the whole page β¨ This was pulled from perl v5.42.3 on 2026-10-18 β mwah π
π
π¦ where this page comes from
- fedora 43: perl-Plack 1.0055-1.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- fedora 44: perl-Plack 1.0055-1.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms