zopefoundation / Products.CMFCore

Key framework services for the Zope Content Management Framework (CMF)
Other
6 stars 20 forks source link

set Cache-Control header in 304 Not Modified response case as well. #111

Closed fdiary closed 3 years ago

fdiary commented 3 years ago

Currently, responses of several CMFCore types do not have Cache-Control header based on Caching Policy Manager in '304 Not Modified' response case. Imagine the following scenario with intermediate cache server (like Apache Traffic Server) :

Thus cache inside intermediate cache server can stay forever, unless Zope returns a different Last-Modified value.

RFC 7232 says :

The server generating a 304 response MUST generate any of the following header fields that would have been sent in a 200 (OK) response to the same request: Cache-Control, Content-Location, Date, ETag, Expires, and Vary.

With this PR, _setCacheHeaders is called before returning '304 Not Modified' so that intermediate cache can update its cache with updated Caching Policy Manager configuration.

dataflake commented 3 years ago

Hi, please take a look at https://www.zope.org/developer/becoming-a-committer.html first and sign the contributor agreement. I'll be happy to look at the PR in detail once that's done and you're an official member in this GitHub organization.

fdiary commented 3 years ago

Hi, please take a look at https://www.zope.org/developer/becoming-a-committer.html first and sign the contributor agreement.

I just sent it.

dataflake commented 3 years ago

@fdiary Did you follow the instruction "On page 2 enter Zope in the field for program"? The contributor admins made you a member of the plonefoundation organization but not zopefoundation?

fdiary commented 3 years ago

@fdiary Did you follow the instruction "On page 2 enter Zope in the field for program"? The contributor admins made you a member of the plonefoundation organization but not zopefoundation?

Yes I did... I'm asking now.