diff --git a/actionpack/lib/action_controller/response.rb b/actionpack/lib/action_controller/response.rb index 429b3eff3210f6165165e40c2beff07204b0bbcb..84edafd7bff297b7082c2c886f956635299c36c2 100755 --- a/actionpack/lib/action_controller/response.rb +++ b/actionpack/lib/action_controller/response.rb @@ -46,7 +46,7 @@ def prepare! def handle_conditional_get! if body.is_a?(String) && (headers['Status'] ? headers['Status'][0..2] == '200' : true) && !body.empty? self.headers['ETag'] ||= %("#{Digest::MD5.hexdigest(body)}") - self.headers['Cache-Control'] = 'private' if headers['Cache-Control'] == DEFAULT_HEADERS['Cache-Control'] + self.headers['Cache-Control'] = 'private, max-age=0, must-revalidate' if headers['Cache-Control'] == DEFAULT_HEADERS['Cache-Control'] if request.headers['HTTP_IF_NONE_MATCH'] == headers['ETag'] self.headers['Status'] = '304 Not Modified' diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index c856fcf19b0f7aa3f57dfeefb6472662888a7452..b6cbe7f9241fb932f3de8c0e0810417aa2f5d130 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -320,6 +320,7 @@ def test_accessing_local_assigns_in_inline_template_with_string_keys def test_render_200_should_set_etag get :render_hello_world_from_variable assert_equal etag_for("hello david"), @response.headers['ETag'] + assert_equal "private, max-age=0, must-revalidate", @response.headers['Cache-Control'] end def test_render_against_etag_request_should_304_when_match