Rename local webpack* var in development env CSP config (#28766)
parent
1b0cb3b54d
commit
c523a9601b
|
@ -52,9 +52,9 @@ Rails.application.config.content_security_policy do |p|
|
||||||
|
|
||||||
if Rails.env.development?
|
if Rails.env.development?
|
||||||
webpacker_public_host = ENV.fetch('WEBPACKER_DEV_SERVER_PUBLIC', Webpacker.config.dev_server[:public])
|
webpacker_public_host = ENV.fetch('WEBPACKER_DEV_SERVER_PUBLIC', Webpacker.config.dev_server[:public])
|
||||||
webpacker_urls = %w(ws http).map { |protocol| "#{protocol}#{Webpacker.dev_server.https? ? 's' : ''}://#{webpacker_public_host}" }
|
front_end_build_urls = %w(ws http).map { |protocol| "#{protocol}#{Webpacker.dev_server.https? ? 's' : ''}://#{webpacker_public_host}" }
|
||||||
|
|
||||||
p.connect_src :self, :data, :blob, *media_hosts, Rails.configuration.x.streaming_api_base_url, *webpacker_urls
|
p.connect_src :self, :data, :blob, *media_hosts, Rails.configuration.x.streaming_api_base_url, *front_end_build_urls
|
||||||
p.script_src :self, :unsafe_inline, :unsafe_eval, assets_host
|
p.script_src :self, :unsafe_inline, :unsafe_eval, assets_host
|
||||||
else
|
else
|
||||||
p.connect_src :self, :data, :blob, *media_hosts, Rails.configuration.x.streaming_api_base_url
|
p.connect_src :self, :data, :blob, *media_hosts, Rails.configuration.x.streaming_api_base_url
|
||||||
|
|
Loading…
Reference in New Issue