Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fully respect disable_caching option #620

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/mini_profiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -425,14 +425,14 @@ def inject_profiler(env, status, headers, body)
# Rack::ETag has already inserted some nonesense in the chain
content_type = headers['Content-Type']

headers['X-MiniProfiler-Original-Cache-Control'] = headers['Cache-Control'] unless headers['Cache-Control'].nil?

if config.disable_caching
headers.delete('ETag')
headers.delete('Date')
headers['Cache-Control'] = "no-store, must-revalidate, private, max-age=0"
end

headers['X-MiniProfiler-Original-Cache-Control'] = headers['Cache-Control'] unless headers['Cache-Control'].nil?
headers['Cache-Control'] = "#{"no-store, " if config.disable_caching}must-revalidate, private, max-age=0"

# inject header
if headers.is_a? Hash
headers['X-MiniProfiler-Ids'] = ids_comma_separated(env)
Expand Down
Loading