Browse Source

Fix #6 - Rate limit GET reqs to 300/5min, POST to 100/5min

closed-social-glitch-2
Eugen Rochko 7 years ago
parent
commit
3b56350121
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      config/initializers/rack-attack.rb

+ 6
- 2
config/initializers/rack-attack.rb View File

@ -1,5 +1,9 @@
class Rack::Attack
throttle('req/ip', limit: 300, period: 5.minutes) do |req|
req.ip
throttle('get-req/ip', limit: 300, period: 5.minutes) do |req|
req.ip if req.get?
end
throttle('post-req/ip', limit: 100, period: 5.minutes) do |req|
req.ip if req.post?
end
end

Loading…
Cancel
Save