mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 17:06:31 -06:00
FIX: properly specify default on no cache on all resources
This commit is contained in:
parent
5613c5f81a
commit
63d9d4f301
@ -45,6 +45,7 @@ class ApplicationController < ActionController::Base
|
||||
before_filter :check_xhr
|
||||
after_filter :add_readonly_header
|
||||
after_filter :perform_refresh_session
|
||||
after_filter :dont_cache_page
|
||||
|
||||
layout :set_layout
|
||||
|
||||
@ -64,6 +65,12 @@ class ApplicationController < ActionController::Base
|
||||
refresh_session(current_user)
|
||||
end
|
||||
|
||||
def dont_cache_page
|
||||
if !response.headers["Cache-Control"] && response.cache_control.blank?
|
||||
response.headers["Cache-Control"] = "no-store, must-revalidate, no-cache, private"
|
||||
end
|
||||
end
|
||||
|
||||
def slow_platform?
|
||||
request.user_agent =~ /Android/
|
||||
end
|
||||
|
@ -529,6 +529,7 @@ describe TopicsController do
|
||||
get :show, topic_id: topic.id, slug: topic.slug
|
||||
expect(response).to be_success
|
||||
expect(css_select("link[rel=canonical]").length).to eq(1)
|
||||
expect(response.headers["Cache-Control"]).to eq("no-store, must-revalidate, no-cache, private")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -46,6 +46,7 @@ describe UserAvatarsController do
|
||||
|
||||
get :show, size: 98, username: user.username, version: upload.id, hostname: 'default'
|
||||
expect(response.body).to eq("image")
|
||||
expect(response.headers["Cache-Control"]).to eq('max-age=31557600, public')
|
||||
end
|
||||
|
||||
it 'serves image even if size missing and its in local mode' do
|
||||
|
Loading…
Reference in New Issue
Block a user