Giter VIP home page Giter VIP logo

plack-middleware-throttle's Introduction

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

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 :

    Hourly
        How many requests an host can do in one hour. The counter is reseted
        each hour.

    Daily
        How many requets an host can do in one hour. The counter is reseted
        each day.

    Interval
        Which interval of time an host must respect between two request.

OPTIONS
    code
        HTTP code returned in the response when the limit have been
        exceeded. By default 503.

    message
        HTTP message returned in the response when the limit have been
        exceeded. By defaylt "Over rate limit".

    backend
        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 get, set and incr 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.

    key_prefix
        Key to prefix sessions entry in the cache.

    path
        URL pattern or a callback to match request to throttle. If no path
        is specified, the whole application will be throttled.

    white_list
        An arrayref of hosts to put in a white list.

    black_list
        An arrayref of hosts to put in a black list.

AUTHOR
    franck cuny <[email protected]>

SEE ALSO
LICENSE
    This library is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.

plack-middleware-throttle's People

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.