diff --git a/actionpack/lib/action_dispatch/middleware/static.rb b/actionpack/lib/action_dispatch/middleware/static.rb index 41c220236a1bd539b8ee1a0851a3a1dc00f95482..3eab3795a0fd3e32cd1b1bf8811ae31f985a7684 100644 --- a/actionpack/lib/action_dispatch/middleware/static.rb +++ b/actionpack/lib/action_dispatch/middleware/static.rb @@ -65,7 +65,7 @@ def serve(request) status, headers, body = @file_server.call(request.env) end - headers['Vary'] = 'Accept-Encoding' if gzip_path + headers['Vary'] = 'Accept-Encoding' return [status, headers, body] ensure diff --git a/actionpack/test/dispatch/static_test.rb b/actionpack/test/dispatch/static_test.rb index ea8b5e904e5e506b8f88fa1d39dbb7427cd174bc..24994c8adb459cfbd90f75eafa3d80f337f45062 100644 --- a/actionpack/test/dispatch/static_test.rb +++ b/actionpack/test/dispatch/static_test.rb @@ -233,7 +233,7 @@ def assert_gzip(file_name, response) def assert_html(body, response) assert_equal body, response.body assert_equal "text/html", response.headers["Content-Type"] - assert_nil response.headers["Vary"] + assert_not_nil response.headers["Vary"] end def get(path, headers = {})