Skip to content

Commit 3635677

Browse files
committed
Only delete if default_headers is defined
Otherwise it will break on Rails 3
1 parent 1c9e848 commit 3635677

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/secure_headers/railtie.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ class Railtie < Rails::Engine
88
ActiveSupport.on_load(:action_controller) do
99
include ::SecureHeaders
1010

11-
conflicting_headers.each do |header|
12-
Rails.application.config.action_dispatch.default_headers.delete(header)
11+
unless Rails.application.config.action_dispatch.default_headers.nil?
12+
conflicting_headers.each do |header|
13+
Rails.application.config.action_dispatch.default_headers.delete(header)
14+
end
1315
end
1416

1517
end

0 commit comments

Comments
 (0)