Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Rack middleware for rate-limiting incoming HTTP requests.

tree: 2ceb767de5

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 doc
Octocat-spinner-32 etc
Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gemspec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .yardopts
Octocat-spinner-32 AUTHORS
Octocat-spinner-32 README
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 UNLICENSE
Octocat-spinner-32 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.