1
0
Fork 0

Configure Rack::Attack

This commit is contained in:
Alex Kotov 2018-12-14 04:58:11 +05:00
parent 64b488e7d6
commit d3b24b8e66
No known key found for this signature in database
GPG Key ID: 4E831250F47DE154
1 changed files with 5 additions and 1 deletions

View File

@ -2,4 +2,8 @@
# Be sure to restart your server when you modify this file.
Rack::Attack.throttle 'requests by IP', limit: 10, period: 1, &:ip
Rack::Attack.throttle 'req/ip', limit: 120, period: 60, &:ip
Rack::Attack.throttle 'user/email', limit: 20, period: 60 do |req|
req.params['email'].presence if req.post? && req.path.start_with?('/users')
end