You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/cache/interaction-cloudflare-products/workers-cache-rules.mdx
+16-2Lines changed: 16 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,8 +32,22 @@ This override behavior is controlled by [compatibility flags](/workers/configura
32
32
33
33
These flags must be enabled to allow Workers scripts to override cache rules.
34
34
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.
36
48
37
49
### Example (Older compatibility date)
38
50
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