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

View file

@ -2,4 +2,8 @@
# Be sure to restart your server when you modify this file. # 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