Skip to content

Commit

Permalink
leave cache-control header alone in its entirety if disable_caching =…
Browse files Browse the repository at this point in the history
… false
  • Loading branch information
glaszig committed Aug 16, 2024
1 parent 6740420 commit ba4475a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/mini_profiler/profiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -453,14 +453,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

0 comments on commit ba4475a

Please sign in to comment.