2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-05 08:59:27 +08:00

FEATURE: add immutable caching to rails site of things

This commit is contained in:
Sam 2017-02-23 13:05:00 -05:00
parent eee22bf037
commit f15f61da0a
6 changed files with 16 additions and 10 deletions

View file

@ -40,7 +40,7 @@ class UserAvatarsController < ApplicationController
response.headers["Last-Modified"] = File.ctime(image).httpdate
response.headers["Content-Length"] = File.size(image).to_s
expires_in 1.year, public: true
immutable_for(1.year)
send_file image, disposition: nil
end
@ -57,7 +57,7 @@ class UserAvatarsController < ApplicationController
response.headers["Last-Modified"] = File.ctime(image).httpdate
response.headers["Content-Length"] = File.size(image).to_s
expires_in 1.year, public: true
immutable_for(1.year)
send_file image, disposition: nil
end
@ -112,7 +112,7 @@ class UserAvatarsController < ApplicationController
if image
response.headers["Last-Modified"] = File.ctime(image).httpdate
response.headers["Content-Length"] = File.size(image).to_s
expires_in 1.year, public: true
immutable_for 1.year
send_file image, disposition: nil
else
render_blank
@ -139,7 +139,7 @@ class UserAvatarsController < ApplicationController
# putting a bogus date cause download is not retaining the data
response.headers["Last-Modified"] = DateTime.parse("1-1-2000").httpdate
response.headers["Content-Length"] = File.size(path).to_s
expires_in 1.year, public: true
immutable_for(1.year)
send_file path, disposition: nil
end