Skip to content

Commit ba4475a

Browse files
committed
leave cache-control header alone in its entirety if disable_caching = false
1 parent 6740420 commit ba4475a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/mini_profiler/profiler.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,14 +453,14 @@ def inject_profiler(env, status, headers, body)
453453
# Rack::ETag has already inserted some nonesense in the chain
454454
content_type = headers['Content-Type']
455455

456+
headers['X-MiniProfiler-Original-Cache-Control'] = headers['Cache-Control'] unless headers['Cache-Control'].nil?
457+
456458
if config.disable_caching
457459
headers.delete('ETag')
458460
headers.delete('Date')
461+
headers['Cache-Control'] = "no-store, must-revalidate, private, max-age=0"
459462
end
460463

461-
headers['X-MiniProfiler-Original-Cache-Control'] = headers['Cache-Control'] unless headers['Cache-Control'].nil?
462-
headers['Cache-Control'] = "#{"no-store, " if config.disable_caching}must-revalidate, private, max-age=0"
463-
464464
# inject header
465465
if headers.is_a? Hash
466466
headers['X-MiniProfiler-Ids'] = ids_comma_separated(env)

0 commit comments

Comments
 (0)