mirror of
https://github.com/System-End/hackatime.git
synced 2026-04-20 00:35:22 +00:00
Add rack attack bypass header
This commit is contained in:
parent
0982ca2588
commit
f4f43d08e8
1 changed files with 7 additions and 0 deletions
|
|
@ -1,6 +1,13 @@
|
|||
# config/initializers/rack_attack.rb
|
||||
|
||||
class Rack::Attack
|
||||
if ENV["RACK_ATTACK_BYPASS"].present?
|
||||
Rack::Attack.safelist("mark any authenticated access safe") do |request|
|
||||
# Requests are allowed if the return value is truthy
|
||||
request.env["HTTP_RACK_ATTACK_BYPASS"] == ENV["RACK_ATTACK_BYPASS"]
|
||||
end
|
||||
end
|
||||
|
||||
# Always allow requests from localhost
|
||||
# (blocklist & throttles are skipped)
|
||||
Rack::Attack.safelist("allow from localhost") do |req|
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue