Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
erp5 erp5
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Labels
    • Labels
  • Merge requests 139
    • Merge requests 139
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedi
  • erp5erp5
  • Merge requests
  • !1247

Closed
Created Aug 21, 2020 by Kazuhiko Shiozaki@kazuhikoOwner
  • Report abuse
Report abuse

WIP: Override cache control header by caching policy manager

  • Overview 10
  • Commits 4
  • Changes 2

This MR is to revert my 5-years-old change, where CachingPolicyManager 'updates' already-computed Cache-Control header, instead of 'overrides' it.

Honestly, I don't remeber the reason why I introduced such change 5 years ago.

(Note that, at the time of writing this, Caching Policy Manger is NOT called for all requests, but for view() and conversion results only. Try grep _setCacheHeaders.)

Here are several cases affected by this MR :

  • For authenticated user access
  1. CookieCrumbler sets Cache-Control: private for ANY authenticated access.
  2. Caching Policy Manager result is max-age=300, public, like by 'public-conversion-result-no-language' policy in generic ERP5.

Without this MR, the result is Cache-Control: private, max-age=300, public but with this MR, the result is Cache-Control: max-age=300, public.

This is the main reason of this MR, so that logged-in user can have benefit of shared server-side cache for DMS conversion result etc.

  • With tricky assignment in form etc.
  1. In form or whatever called in view() processing, set explicitly RESPONSE.setHeader('Cache-Control', 'no-store')
  2. But Caching Policy Manager result is max-age=300, public

Without this MR, the result is Cache-Control: no-store, max-age=300, public but with this MR, the result is Cache-Control: max-age=300, public.

For me, such no-store, public is non-sense and Caching Policy Manager should be always responsible for any 'matching' case. Also, if we want to support such, we can still create a dedicated Caching Policy by checking like 'no-store' in (request.RESPONSE.getHeader('Cache-Control') or '').lower() in its Predicate configuration.

/cc @romain @jerome @cedric.leninivin @vpelletier

Edited Aug 24, 2020 by Kazuhiko Shiozaki
Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: override_cache_control_header_by_caching_policy_manager
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7