From b60c1fe97be3af8baf982aaa4638811a37f7a7e9 Mon Sep 17 00:00:00 2001 From: Kohei Suzuki Date: Thu, 12 Mar 2015 23:14:01 +0900 Subject: Also skip Content-Encoding and Vary header if 304 --- actionpack/lib/action_dispatch/middleware/static.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_dispatch/middleware/static.rb b/actionpack/lib/action_dispatch/middleware/static.rb index f5c2acbfb9..fdd1bc4e69 100644 --- a/actionpack/lib/action_dispatch/middleware/static.rb +++ b/actionpack/lib/action_dispatch/middleware/static.rb @@ -47,10 +47,11 @@ module ActionDispatch if gzip_path && gzip_encoding_accepted?(env) env['PATH_INFO'] = gzip_path status, headers, body = @file_server.call(env) - headers['Content-Encoding'] = 'gzip' - if status != 304 - headers['Content-Type'] = content_type(path) + if status == 304 + return [status, headers, body] end + headers['Content-Encoding'] = 'gzip' + headers['Content-Type'] = content_type(path) else status, headers, body = @file_server.call(env) end -- cgit v1.2.3