Skip to content
Snippets Groups Projects
Commit 964035b1 authored by gled's avatar gled Committed by Eugen Rochko
Browse files

allow localhost to bypass the ratelimit (#2554)

parent 5135d609
Branches
Tags
No related merge requests found
# frozen_string_literal: true
class Rack::Attack
# Always allow requests from localhost
# (blocklist & throttles are skipped)
Rack::Attack.safelist('allow from localhost') do |req|
# Requests are allowed if the return value is truthy
'127.0.0.1' == req.ip || '::1' == req.ip
end
# Rate limits for the API
throttle('api', limit: 300, period: 5.minutes) do |req|
req.ip if req.path =~ /\A\/api\/v/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment