mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-04-27 15:07:41 +00:00
Use correct HTTP status codes for blackist and throttle
This commit is contained in:
parent
237dc2d944
commit
cfbee2c552
1 changed files with 2 additions and 2 deletions
|
|
@ -39,10 +39,10 @@ module Rack::Attack
|
||||||
|
|
||||||
# Set defaults
|
# Set defaults
|
||||||
@notifier ||= ActiveSupport::Notifications if defined?(ActiveSupport::Notifications)
|
@notifier ||= ActiveSupport::Notifications if defined?(ActiveSupport::Notifications)
|
||||||
@blacklisted_response ||= lambda {|env| [503, {}, ["Blocked\n"]] }
|
@blacklisted_response ||= lambda {|env| [401, {}, ["Unauthorized\n"]] }
|
||||||
@throttled_response ||= lambda {|env|
|
@throttled_response ||= lambda {|env|
|
||||||
retry_after = env['rack.attack.match_data'][:period] rescue nil
|
retry_after = env['rack.attack.match_data'][:period] rescue nil
|
||||||
[503, {'Retry-After' => retry_after.to_s}, ["Retry later\n"]]
|
[429, {'Retry-After' => retry_after.to_s}, ["Retry later\n"]]
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
self
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue