-
Notifications
You must be signed in to change notification settings - Fork 10.4k
CACHE-11939: add request cf overriding cache rules compat flags #20965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Howdy and thanks for contributing to our repo. The Cloudflare team reviews new, external PRs within two (2) weeks. If it's been two weeks or longer without any movement, please tag the PR Assignees in a comment. We review internal PRs within 1 week. If it's something urgent or has been sitting without a comment, start a thread in the Developer Docs space internally. PR Change SummaryAdded compatibility flags to enhance cache behavior for Fetch and Cache APIs, allowing settings in the request.cf object to take precedence over Cache Rules.
Added Files
How can I customize these reviews?Check out the Hyperlint AI Reviewer docs for more information on how to customize the review. If you just want to ignore it on this PR, you can add the Note specifically for link checks, we only check the first 30 links in a file and we cache the results for several hours (for instance, if you just added a page, you might experience this). Our recommendation is to add |
9cf6bee to
120fcf8
Compare
| disable_flag: "no_request_cf_overrides_cache_rules" | ||
| --- | ||
|
|
||
| This flag fixes the behavior of cache when requesting assets via the Fetch API whereby the cache settings specified in the `request.cf` object is given precedence over any Cache Rules set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| This flag fixes the behavior of cache when requesting assets via the Fetch API whereby the cache settings specified in the `request.cf` object is given precedence over any Cache Rules set. | |
| This flag changes the behavior of cache when requesting assets via the [Fetch API](/workers/runtime-apis/fetch). Cache settings specified in the `request.cf` object, such as `cacheEverything` and `cacheTtl`, are now given precedence over any [Cache Rules]([/cache/how-to/cache-rules/) set. |
|
|
||
| This flag fixes the behavior of cache when requesting assets via the Fetch API whereby the cache settings specified in the `request.cf` object is given precedence over any Cache Rules set. | ||
|
|
||
| With the flag enabled - either by default after 2025-03-26 or by setting the `request_cf_overrides_cache_rules` flag - any cache related settings in a Worker's `request.cf` object such as (`cacheEverything`, `cacheTtl`, etc) will override any cache rules for the target asset in subrequest. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| With the flag enabled - either by default after 2025-03-26 or by setting the `request_cf_overrides_cache_rules` flag - any cache related settings in a Worker's `request.cf` object such as (`cacheEverything`, `cacheTtl`, etc) will override any cache rules for the target asset in subrequest. | |
| This flag will be enabled by default for any compatibility date after 2025-03-26. |
|
@yj7o5 - Added some suggestions but +1s so I'm not blocking. Slightly more direct wording, some links, and combined two lines that were doing the same thing. |
src/content/compatibility-flags/fetch-api-request-cf-overrides-cache-rules.md
Outdated
Show resolved
Hide resolved
src/content/compatibility-flags/fetch-api-request-cf-overrides-cache-rules.md
Outdated
Show resolved
Hide resolved
Head branch was pushed to by a user without write access
|
Congratulations @yj7o5, the maintainer of this repository has issued you a holobyte! Here it is: https://holopin.io/holobyte/cm90aaozs04520cjsd3gw0jy4 This badge can only be claimed by you, so make sure that your GitHub account is linked to your Holopin account. You can manage those preferences here: https://holopin.io/account. |
Co-authored-by: Yawar Jamal <[email protected]>
Summary
Adding a new compatibility flags:
request_cf_overrides_cache_rules. The Cache team has fixed a behavior in cache recently for workers scripts that make subrequests either via the Fetch where by the cache settings in therequest.cfobject specified given the precedence vs Cache Rules. Up until now, for example, ifcacheTtlwas specified in both the worker script and a cache rule was configured to modifycacheTtlfor the requested resource, cache rules would override thecacheTtlspecified in therequest.cfobject. However, with the upcoming change, we have updated Cache such if the above flags are enabled then settings specified in therequest.cfobject take precedence.Documentation checklist