Add prefill api to rack_attack

This commit is contained in:
Damien Le Thiec 2022-12-14 17:57:08 +01:00 committed by LeSim
parent 490a997e97
commit 493a60f221

View file

@ -17,6 +17,12 @@ class Rack::Attack
end
end
throttle('/api/public/v1/dossiers/ip', limit: 5, period: 20.seconds) do |req|
if req.path == '/api/public/v1/dossiers' && req.post? && rack_attack_enabled?
req.remote_ip
end
end
Rack::Attack.safelist('allow from localhost') do |req|
IPService.ip_trusted?(req.remote_ip)
end