block clients sending many POST requests
This commit is contained in:
parent
e218b13073
commit
1bec0c1332
|
@ -35,6 +35,16 @@ class Rack::Attack
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
####
|
||||||
|
# Ban based on: IP address or access token
|
||||||
|
# Ban time: 1 hour
|
||||||
|
# Ban after: 10 POST requests within 30 seconds
|
||||||
|
blacklist('spamming with POST requests') do |request|
|
||||||
|
Rack::Attack::Allow2Ban.filter(request.identifier, maxretry: 10, findtime: 30.seconds, bantime: 1.hour) do
|
||||||
|
request.post?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
###
|
###
|
||||||
# Throttle: unauthenticated requests - 50 per minute
|
# Throttle: unauthenticated requests - 50 per minute
|
||||||
# Scoped by: IP address
|
# Scoped by: IP address
|
||||||
|
|
Loading…
Reference in New Issue
Block a user