Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Rack middleware for rate-limiting incoming HTTP requests.
tree: e8d203f4af

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
doc
etc
lib/rack
spec
.gemspec
.gitignore
.yardopts
AUTHORS
README
README.md
Rakefile
UNLICENSE
VERSION

README.md

HTTP Request Rate Limiter for Rack

This is Rack middleware that provides logic for rate-limiting incoming HTTP requests to your Rack application. You can use Rack::Throttle with any Ruby web framework based on Rack, including with Ruby on Rails 3.0 and with Sinatra.

Examples

Adding throttling to a Rackup application

require 'rack/throttle'

use Rack::Throttle::Interval

run lambda { |env| [200, {'Content-Type' => 'text/plain'}, "Hello, world!\n"] }

Enforcing a 3-second interval between requests

use Rack::Throttle::Interval, :min => 3.0

Using Memcached to store rate-limiting counters

use Rack::Throttle::Interval, :cache => Memcached.new, :key_prefix => :throttle

Documentation

http://datagraph.rubyforge.org/rack-throttle/

  • {Rack::Throttle}
    • {Rack::Throttle::Interval}
    • {Rack::Throttle::Daily}
    • {Rack::Throttle::Hourly}

Dependencies

Installation

The recommended installation method is via RubyGems. To install the latest official release, do:

% [sudo] gem install rack-throttle

Download

To get a local working copy of the development repository, do:

% git clone git://github.com/datagraph/rack-throttle.git

Alternatively, you can download the latest development version as a tarball as follows:

% wget http://github.com/datagraph/rack-throttle/tarball/master

Author

License

Rack::Throttle is free and unencumbered public domain software. For more information, see http://unlicense.org/ or the accompanying UNLICENSE file.

Something went wrong with that request. Please try again.