Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • erp5 erp5
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Merge requests 142
    • Merge requests 142
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedinexedi
  • erp5erp5
  • Merge requests
  • !1382

add Cache-Control header in '304 Not Modified' response case as well.

  • Review changes

  • Download
  • Patches
  • Plain diff
Closed Kazuhiko Shiozaki requested to merge cache-control-304-response into master Mar 26, 2021
  • Overview 3
  • Commits 2
  • Pipelines 0
  • Changes 6

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

  • intermediate cache server fetches from Zope and store it in its cache.
  • we modify Caching Policy Manager configuration.
  • intermediate cache server tries to revalidate its cache with 'If-Modified-Since' header.
  • Zope responses '304 Not Modified' with the same Last-Modified value but without (updated) Cache-Control header.
  • intermediate cache server does not (cannot) update its cache with updated cache configuration.

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.

Note that this bug also exists in CMFCore where Caching Policy Manager is implemented. zopefoundation/Products.CMFCore#111 (merged)

Edited Apr 01, 2021 by Kazuhiko Shiozaki
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: cache-control-304-response
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7