diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb index 9da1201c79d..42d776e99a9 100644 --- a/app/controllers/static_controller.rb +++ b/app/controllers/static_controller.rb @@ -136,6 +136,7 @@ class StaticController < ApplicationController opts[:type] = "application/javascript" if path =~ /\.js.br$/ response.headers["Expires"] = 1.year.from_now.httpdate + response.headers["Cache-Control"] = 'max-age=31557600, public' response.headers["Content-Encoding"] = 'br' begin response.headers["Last-Modified"] = File.ctime(path).httpdate diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e1400e9883a..e3689036be3 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -49,7 +49,7 @@ module ApplicationHelper if GlobalSetting.cdn_url && GlobalSetting.cdn_url.start_with?("https") && ENV["COMPRESS_BROTLI"] == "1" && - request.env["ACCEPT_ENCODING"] =~ /br/ + request.env["HTTP_ACCEPT_ENCODING"] =~ /br/ tags = javascript_include_tag(*args) tags.gsub!("#{GlobalSetting.cdn_url}/assets/", "#{GlobalSetting.cdn_url}/brotli_asset/") tags.html_safe