Merge pull request #8284 from demarches-simplifiees/feature/rate_limiting_prefill_api
Add prefill api to rack_attack
This commit is contained in:
commit
6f2912b4db
1 changed files with 6 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue