mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Allow CSP to be enabled during QUnit tests (#8668)
The QUnit rake task starts a server in test mode. We need a tweak to allow dynamic CSP hostnames in test mode. This tweak is already present in development mode. To allow CSP to work, the browser host/port must match what the server sees. Therefore we need to disable the enforce_hostname middleware in test mode. To keep rspec and production as similar as possible, we skip enforce_hostname using an environment variable. Also move the qunit rake task to use unicorn, for consistency with development and production.
This commit is contained in:
@@ -224,7 +224,7 @@ module Discourse
|
||||
# supports etags (post 1.7)
|
||||
config.middleware.delete Rack::ETag
|
||||
|
||||
unless Rails.env.development?
|
||||
if !(Rails.env.development? || ENV['SKIP_ENFORCE_HOSTNAME'] == "1")
|
||||
require 'middleware/enforce_hostname'
|
||||
config.middleware.insert_after Rack::MethodOverride, Middleware::EnforceHostname
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user