# in .psgi use Plack::Builder; my $app = sub { ... }; builder { enable "Plack::Middleware::AccessLog", format => "combined"; enable "Plack::Middleware::ContentLength"; enable "Plack::Middleware::ErrorDocument", 404 => '/path/to/error_404.html', 500 => '/path/to/error_500.html'; enable "Plack::Middleware::Lint"; enable sub { my $app = shift; sub { my $env = shift; $app->($env); }; }; $app; };