mirror of
https://github.com/discourse/discourse.git
synced 2025-01-30 05:05:15 +08:00
correct headers and add better caching
This commit is contained in:
parent
55b35a05ed
commit
8a98d617df
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user