FIX: not serving non brotli cdns from cdn_url

(this means that access control allow origin could break)
This commit is contained in:
Sam 2017-10-03 11:20:08 +11:00
parent 1022535c2b
commit eaa896d8ee
1 changed files with 2 additions and 0 deletions

View File

@ -60,6 +60,8 @@ module ApplicationHelper
ENV["COMPRESS_BROTLI"] == "1" &&
request.env["HTTP_ACCEPT_ENCODING"] =~ /br/
path.gsub!("#{GlobalSetting.cdn_url}/assets/", "#{GlobalSetting.cdn_url}/brotli_asset/")
elsif GlobalSetting.cdn_url
path.gsub!("#{GlobalSetting.cdn_url}/assets/", "#{GlobalSetting.cdn_url}/cdn_asset/")
end
"<link rel='preload' href='#{path}' as='script'/>
<script src='#{path}'></script>".html_safe