NAME
Plack::Middleware::LimitRequest - HTTP Request Limitation for Plack apps
SYNOPSIS
use Plack::Builder;
my $app = sub { ... };
builder {
enable 'LimitRequest',
body => 102400,
fields => 50,
field_size => 4094,
line => 4094
;
$app;
};
DESCRIPTION
Plack::Middleware::LimitRequest provides HTTP request size limitation for HTTP request body, the number of request header fields, size of an HTTP request header field and size of a client's HTTP request-line. It works similar to Apache core directives, LimitRequestBody
, LimitRequestFields
, LimitRequestFieldSize
and LimitRequestLine
. This is useful to protect against kind of DDoS attacks.
If your application is working behind some Apache reverse proxy servers (using mod_proxy module), most of directives above works correctly, so you should configure them on the Apache configuration. But, only LimitRequestBody
directive does not work for proxied requests. This module solves, especially in the case that demand to limit for the size of HTTP request body.
ARGUMENTS
body
It allows to set a limit on the allowed size of an HTTP request message body. Default is 0
. If you don't want to limit the size, set this argument to 0
(means unlimited) or unset (omit it on your .psgi file).
fields
It allows to modify the limit on the number of request header fields allowed in an HTTP request. Default is 100
. If you don't want to limit the number, set this argument to 0
(means unlimited).
field_size
It allows to set the limit on the allowed size of an HTTP request header field. Default is 8190
. If you don't want to limit the size, set this argument to 0
(means unlimited).
line
It allows to set the limit on the allowed size of a client's HTTP request-line. Since the request-line consists of the HTTP method, URI, and protocol version. Default is 8190
. If you don't want to limit the size, set this argument to 0
(means unlimited).
AUTHOR
Koichi Taniguchi (a.k.a. nipotan) <taniguchi@cpan.org>
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.