mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-03-25 09:25:49 +00:00
Cleanup README
This commit is contained in:
parent
32eac5caf1
commit
623c1ea05d
1 changed files with 6 additions and 10 deletions
16
README.md
16
README.md
|
|
@ -8,28 +8,29 @@ Thottle state is stored in a configurable cache (e.g. `Rails.cache`), presumably
|
|||
|
||||
## Installation
|
||||
|
||||
Add `rack-attack` to your Gemfile or run
|
||||
Add "rack-attack" to your Gemfile or run
|
||||
|
||||
gem install rack-attack
|
||||
|
||||
Tell your app to use the `Rack::Attack` middleware.
|
||||
Tell your app to use the Rack::Attack middleware.
|
||||
For Rails 3 apps:
|
||||
|
||||
# In config/application.rb
|
||||
config.middleware.use Rack::Attack
|
||||
|
||||
Or in your `config.ru`:
|
||||
|
||||
use Rack::Attack
|
||||
|
||||
Optionally configure the cache store for throttling:
|
||||
|
||||
Rack::Attack.cache.store = my_cache_store # defaults to Rails.cache
|
||||
Rack::Attack.cache.store = my_cache_store # defaults to Rails.cache
|
||||
|
||||
Note that `Rack::Attack.cache` is only used for throttling, not blacklisting & whitelisting.
|
||||
|
||||
## How it works
|
||||
|
||||
The Rack::Attack middleware examines each request against *whitelists*, *blacklists*, and *throttles* that you define.
|
||||
By default, there are no whitelists, blacklists, or throttles.
|
||||
The Rack::Attack middleware examines each request against *whitelists*, *blacklists*, and *throttles* that you define. There are none by default.
|
||||
|
||||
* If the request matches any whitelist, the request is allowed. Blacklists and throttles are not checked.
|
||||
* If the request matches any blacklist, the request is blocked. Throttles are not checked.
|
||||
|
|
@ -83,9 +84,4 @@ less on short-term, one-off hacks to block a particular attack.
|
|||
|
||||
Rack::Attack complements `iptables` and nginx's [limit_zone module](http://wiki.nginx.org/HttpLimitZoneModule).
|
||||
|
||||
## Processing order
|
||||
* If any whitelist matches, the request is allowed
|
||||
* If any blacklist matches, the request is blocked (unless a whitelist matched)
|
||||
* If any throttle matches, the request is throttled (unless a whitelist or blacklist matched)
|
||||
|
||||
[](http://travis-ci.org/ktheory/rack-attack)
|
||||
|
|
|
|||
Loading…
Reference in a new issue