Skip to content

Commit bd5c50e

Browse files
committed
leave cache-control header alone in its entirety if disable_caching = false
closes #616
1 parent 92610ca commit bd5c50e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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[Rack::CONTENT_TYPE]
427427

428+
headers['x-miniprofiler-original-cache-control'] = headers[Rack::CACHE_CONTROL] unless headers[Rack::CACHE_CONTROL].nil?
429+
428430
if config.disable_caching
429431
headers.delete(Rack::ETAG)
430432
headers.delete('date') || headers.delete('Date')
433+
headers[Rack::CACHE_CONTROL] = "no-store, must-revalidate, private, max-age=0"
431434
end
432435

433-
headers['x-miniprofiler-original-cache-control'] = headers[Rack::CACHE_CONTROL] unless headers[Rack::CACHE_CONTROL].nil?
434-
headers[Rack::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)