diff options
| author | mo khan <mo@mokhan.ca> | 2014-09-10 20:36:15 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-09-10 20:36:15 -0600 |
| commit | a1b2bbeed809a25788f02345df4e07cdc2ab8849 (patch) | |
| tree | 5e4f442430dd8290e940c49d8c8e5b273815a351 /config/initializers | |
| parent | 0aa335b1a2ef620bb0f26f519a62fdf059e3f875 (diff) | |
whitelist localhost.
Diffstat (limited to 'config/initializers')
| -rw-r--r-- | config/initializers/rack_attack.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb index 2caa81d4..7a26dd95 100644 --- a/config/initializers/rack_attack.rb +++ b/config/initializers/rack_attack.rb @@ -1,3 +1,10 @@ +# Always allow requests from localhost +# (blacklist & throttles are skipped) +Rack::Attack.whitelist('allow from localhost') do |request| + # Requests are allowed if the return value is truthy + '127.0.0.1' == request.ip +end + # Throttle requests to 5 requests per second per ip Rack::Attack.throttle('req/ip', :limit => 5, :period => 1.second) do |request| # If the return value is truthy, the cache key for the return value |
