GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  PLACK::MIDDLEWARE::THROTTLE (3)

.ds Aq ’

NAME

Plack::Middleware::Throttle - A Plack Middleware for rate-limiting incoming HTTP requests.

CONTENTS

SYNOPSIS



  my $handler = builder {
    enable "Throttle::Hourly",
        max     => 2,
        backend => Plack::Middleware::Throttle::Backend::Hash->new(),
        path    => qr{^/api};
    sub { [ 200, [ Content-Type => text/html ], [hello world] ] };
  };



DESCRIPTION

This is a Plack middleware that provides logic for rate-limiting incoming HTTP requests to Rack applications.

This middleware provides three ways to handle throttling on incoming requests :
<B>HourlyB> How many requests an host can do in one hour. The counter is reseted each hour.
<B>DailyB> How many requets an host can do in one hour. The counter is reseted each day.
<B>IntervalB> Which interval of time an host must respect between two request.

OPTIONS

<B>codeB> HTTP code returned in the response when the limit have been exceeded. By default 503.
<B>messageB> HTTP message returned in the response when the limit have been exceeded. By defaylt Over rate limit.
<B>backendB> A cache object to store sessions informations.



  backend => Redis->new(server => 127.0.0.1:6379);



or



  backend => Cache::Memcached->new(servers => ["10.0.0.15:11211", "10.0.0.15:11212"]);



The cache object must implement <B>getB>, <B>setB> and <B>incrB> methods. By default, you can use Plack::Middleware::Throttle::Backend::Hash.

By default, if no backend is specified, Plack::Middleware::Throttle::Backend::Hash is used.

<B>key_prefixB> Key to prefix sessions entry in the cache.
<B>pathB> URL pattern or a callback to match request to throttle. If no path is specified, the whole application will be throttled.
<B>white_listB> An arrayref of hosts to put in a white list.
<B>black_listB> An arrayref of hosts to put in a black list.

AUTHOR

franck cuny <franck@lumberjaph.net>

SEE ALSO

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 PLACK::MIDDLEWARE::THROTTLE (3) 2010-04-28

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.