Skip to content

Commit 2900bbc

Browse files
Add worker isolation docs, update limits/pricing pages, and remove old changelog page (#24275)
* Add worker isolation docs, update limits/pricing pages, and remove old changelog page * Update src/content/docs/cloudflare-for-platforms/workers-for-platforms/platform/worker-isolation.mdx Co-authored-by: Brendan Irvine-Broque <[email protected]> * Update src/content/docs/cloudflare-for-platforms/workers-for-platforms/platform/worker-isolation.mdx Co-authored-by: Brendan Irvine-Broque <[email protected]> * address comments --------- Co-authored-by: Brendan Irvine-Broque <[email protected]>
1 parent 14ed8ee commit 2900bbc

File tree

4 files changed

+58
-17
lines changed

4 files changed

+58
-17
lines changed

src/content/docs/cloudflare-for-platforms/workers-for-platforms/platform/changelog.mdx

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/content/docs/cloudflare-for-platforms/workers-for-platforms/platform/limits.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pcx_content_type: concept
33
title: Limits
44
sidebar:
5-
order: 1
5+
order: 2
66

77
---
88

@@ -14,7 +14,9 @@ Cloudflare provides an unlimited number of scripts for Workers for Platforms cus
1414

1515
## `cf` object
1616

17-
The [`cf` object](/workers/runtime-apis/request/#the-cf-property-requestinitcfproperties) contains Cloudflare-specific properties of a request. This field is not accessible in [user Workers](/cloudflare-for-platforms/workers-for-platforms/reference/how-workers-for-platforms-works/#user-workers) because some fields in this object are sensitive and can be used to manipulate Cloudflare features (for example, `cacheKey`, `resolveOverride`, `scrapeShield`.)
17+
The [`cf` object](/workers/runtime-apis/request/#the-cf-property-requestinitcfproperties) contains Cloudflare-specific properties of a request. This field is not accessible in [user Workers](/cloudflare-for-platforms/workers-for-platforms/reference/how-workers-for-platforms-works/#user-workers) by default because some fields in this object are sensitive and can be used to manipulate Cloudflare features (for example, `cacheKey`, `resolveOverride`, `scrapeShield`.)
18+
19+
To access the `cf` object, you need to enable [trusted mode](/cloudflare-for-platforms/workers-for-platforms/platform/worker-isolation/#trusted-mode) for your namespace. Only enable this if you control all Worker code in the namespace.
1820

1921
## Durable Object namespace limits
2022

src/content/docs/cloudflare-for-platforms/workers-for-platforms/platform/pricing.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pcx_content_type: concept
33
title: Pricing
44
sidebar:
5-
order: 1
5+
order: 3
66

77
---
88

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
pcx_content_type: concept
3+
title: Worker Isolation
4+
sidebar:
5+
order: 1
6+
7+
---
8+
9+
### Untrusted Mode (Default)
10+
11+
By default, Workers inside of a dispatch namespace are considered "untrusted." This provides the strongest isolation between Workers and is best in cases where your customers have control over the code that's being deployed.
12+
13+
In untrusted mode:
14+
15+
- The [`request.cf`](/workers/runtime-apis/request/#incomingrequestcfproperties) object is not available in Workers (see [limits](/cloudflare-for-platforms/workers-for-platforms/platform/limits/#cf-object) for more information)
16+
- Each Worker has an isolated cache, when using the [Cache API](/workers/runtime-apis/cache/) or when making subrequests using `fetch()`, which egress via [Cloudflare's cache](/cache/)
17+
- [`caches.default`](/workers/reference/how-the-cache-works/#cache-api) is disabled for all Workers in the namespace
18+
19+
This mode ensures complete isolation between customer Workers, preventing any potential cross-tenant data access.
20+
21+
### Trusted Mode
22+
23+
If you control the Worker code and want to disable isolation mode, you can configure the namespace as "trusted". This is useful when building internal platforms where your company controls all Worker code.
24+
25+
In trusted mode:
26+
27+
- The [`request.cf`](/workers/runtime-apis/request/#incomingrequestcfproperties) object becomes available, providing access to request metadata
28+
- All Workers in the namespace share the same cache space when using the Cache API
29+
30+
:::note
31+
In trusted mode, Workers can potentially access cached responses from other Workers in the namespace. Only enable this if you control all Worker code or have appropriate cache key isolation strategies.
32+
:::
33+
34+
To convert a namespace from untrusted to trusted:
35+
```bash
36+
curl -X PUT "https://api.cloudflare.com/client/v4/accounts/{account_id}/workers/dispatch/namespaces/{namespace_name}" \
37+
-H "Authorization: Bearer {api_token}" \
38+
-H "Content-Type: application/json" \
39+
-d '{
40+
"name": "{namespace_name}",
41+
"trusted_workers": true
42+
}'
43+
```
44+
45+
If you enable trusted mode for a namespace that already has deployed Workers, you'll need to redeploy those Workers for the `request.cf` object to become available. Any new Workers you deploy after enabling trusted mode will automatically have access to it.
46+
47+
### Maintaining cache isolation in trusted mode
48+
If you need access to `request.cf` but want to maintain cache isolation between customers, use customer-specific [cache keys](/workers/examples/cache-using-fetch/#custom-cache-keys) or the [Cache API](/workers/examples/cache-api/) with isolated keys.
49+
50+
## Related Resources
51+
* [Platform Limits](/cloudflare-for-platforms/workers-for-platforms/platform/limits) - Understanding script and API limits
52+
* [Cache API Documentation](/workers/runtime-apis/cache/) - Learn about cache behavior in Workers
53+
* [Request cf object](/workers/runtime-apis/request/#the-cf-property-requestcf) - Details on the cf object properties

0 commit comments

Comments
 (0)