Skip to content

Commit 132209a

Browse files
committed
Updates cache api workers override cache rules information
1 parent c529d7a commit 132209a

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/content/docs/cache/interaction-cloudflare-products/workers-cache-rules.mdx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,22 @@ This override behavior is controlled by [compatibility flags](/workers/configura
3232

3333
These flags must be enabled to allow Workers scripts to override cache rules.
3434

35-
If your Worker has a compatibility date of 2025-04-02 or earlier, these flags are not enabled by default. In that case, cache settings defined in the Worker will not override existing cache rules.
35+
### Compatibility date behavior
36+
37+
Whether these flags are enabled by default depends on your Worker's compatibility date:
38+
39+
- **Fetch API (`request_cf_overrides_cache_rules`)**
40+
- Enabled by default for compatibility dates **on or after 2025-04-02**.
41+
- **Cache API (`cache_api_request_cf_overrides_cache_rules`)**
42+
- Enabled by default for compatibility dates **on or after 2025-05-19**.
43+
- **Important:** For this flag to be recognized, you must also enable `cache_api_compat_flags`.
44+
- `cache_api_compat_flags` enables the compatibility flag functionality for Workers. If it is not set, then no compatibility flags — even if configured — will be recognized by the Cache API.
45+
- This flag is enabled by default for compatibility dates **on or after 2025-04-19**.
46+
47+
If your Worker has an earlier compatibility date than the ones listed above, the corresponding flags must be manually enabled; otherwise, cache behavior will follow the original cache rules instead of the Worker's settings.
3648

3749
### Example (Older compatibility date)
3850

39-
If a cache rule is configured to bypass cache for `example.com/foo`, and a Worker with a compatibility date of `2025-04-02` or earlier tries to set `cacheEverything: true`, the cache rule will take effect — and the response will not be cached.
51+
If a cache rule is configured to bypass cache for `example.com/foo`, and a Worker with a compatibility date of `2025-04-02` or earlier tries to set `cacheEverything: true`, the cache rule will take effect — and the response will not be cached.
52+
53+
Likewise, if using the Cache API without `cache_api_compat_flags` enabled, even if you enable `cache_api_request_cf_overrides_cache_rules`, it will not take effect.

0 commit comments

Comments
 (0)