Skip to content

Commit 4f6e8bd

Browse files
committed
leave cache-control header alone in its entirety if disable_caching = false
1 parent 5e42a57 commit 4f6e8bd

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/mini_profiler.rb

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

428+
headers['X-MiniProfiler-Original-Cache-Control'] = headers['Cache-Control'] unless headers['Cache-Control'].nil?
429+
428430
if config.disable_caching
429431
headers.delete('ETag')
430432
headers.delete('Date')
433+
headers['Cache-Control'] = "no-store, must-revalidate, private, max-age=0"
431434
end
432435

433-
headers['X-MiniProfiler-Original-Cache-Control'] = headers['Cache-Control'] unless headers['Cache-Control'].nil?
434-
headers['Cache-Control'] = "#{"no-store, " if config.disable_caching}must-revalidate, private, max-age=0"
435-
436436
# inject header
437437
if headers.is_a? Hash
438438
headers['X-MiniProfiler-Ids'] = ids_comma_separated(env)

0 commit comments

Comments
 (0)