diff --git a/lib/mini_profiler/profiler.rb b/lib/mini_profiler/profiler.rb index 91918ed5..f4954803 100644 --- a/lib/mini_profiler/profiler.rb +++ b/lib/mini_profiler/profiler.rb @@ -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)