Security Advisories (3)
CPANSA-Plack-2015-0202 (2015-02-02)

Fixed a possible directory traversal with Plack::App::File on Win32.

CPANSA-Plack-2014-0801 (2014-08-01)

Plack::App::File would previously strip trailing slashes off provided paths. This in combination with the common pattern of serving files with Plack::Middleware::Static could allow an attacker to bypass a whitelist of generated files

CPANSA-Plack-2013-0131 (2013-01-31)

Fixed directory traversal bug in Plack::App::File on win32 environments

NAME

Plack::Middleware::ErrorDocument - Set Error Document based on HTTP status code

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

Plack::Middleware::ErrorDocument allows you to customize error screen by setting paths (file system path or URI path) of error pages per status code.

CONFIGURATIONS

subrequest

A boolean flag to serve error pages using a new GET sub request. Defaults to false, which means it serves error pages using file system path.

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;
};

This configuration serves 502 error pages from file system directly assuming that's when you probably maintain database etc. but serves 404 and 403 pages using a sub request so your application can do some logic there like logging or doing suggestions.

AUTHOR

Tatsuhiko Miyagawa

SEE ALSO