diff --git a/CHANGELOG.md b/CHANGELOG.md index e44a446..198b221 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changlog ## master (unreleased) + - Default throttled/blacklist responses have Content-Type: text/plain - Rack::Attack.clear! resets tracks ## v4.0.1 - 14 May 2014 diff --git a/lib/rack/attack.rb b/lib/rack/attack.rb index 0ec982c..78fb386 100644 --- a/lib/rack/attack.rb +++ b/lib/rack/attack.rb @@ -80,10 +80,10 @@ class Rack::Attack # Set defaults @notifier = ActiveSupport::Notifications if defined?(ActiveSupport::Notifications) - @blacklisted_response = lambda {|env| [403, {}, ["Forbidden\n"]] } + @blacklisted_response = lambda {|env| [403, {'Content-Type' => 'text/plain'}, ["Forbidden\n"]] } @throttled_response = lambda {|env| retry_after = env['rack.attack.match_data'][:period] rescue nil - [429, {'Retry-After' => retry_after.to_s}, ["Retry later\n"]] + [429, {'Content-Type' => 'text/plain', 'Retry-After' => retry_after.to_s}, ["Retry later\n"]] } def initialize(app)