Skip to content

Commit e363093

Browse files
committed
[Workers] Add cross-references and tighten URL framing in Previews docs
1 parent 17c8242 commit e363093

3 files changed

Lines changed: 41 additions & 39 deletions

File tree

src/content/docs/workers/previews/concepts.mdx

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,34 @@ One Preview can have many deployments over its lifetime. The latest deployment i
2020

2121
**Preview settings** are the shared defaults stored on Cloudflare that apply to every new Preview on a Worker. They include:
2222

23-
- Bindings (KV, D1, R2, Durable Objects, and so on)
24-
- Environment variables
25-
- Secrets
26-
- Observability, Logpush, and Tail Worker settings
27-
- Runtime limits
23+
- [Bindings](/workers/runtime-apis/bindings/) ([KV](/kv/), [D1](/d1/), [R2](/r2/), [Durable Objects](/durable-objects/), and so on)
24+
- [Environment variables](/workers/configuration/environment-variables/)
25+
- [Secrets](/workers/configuration/secrets/)
26+
- [Observability](/workers/observability/logs/workers-logs/), [Logpush](/workers/observability/logs/logpush/), and [Tail Worker](/workers/observability/logs/tail-workers/) settings
27+
- Runtime [limits](/workers/platform/limits/)
2828

2929
Preview settings are distinct from your Production settings. Previews never inherit from production.
3030

3131
When you create a new Preview — via `wrangler preview`, CI, the dashboard, or a pull request — it starts with your Worker's Preview settings. Individual deployments can override those values for one deployment without changing the shared settings. See [Per-deployment overrides](/workers/previews/configuring-previews/#per-deployment-overrides).
3232

3333
## Preview URLs
3434

35-
Every Preview has an auto-generated URL on the `workers.dev` subdomain:
35+
Every Preview has two kinds of URLs on the `workers.dev` subdomain.
36+
37+
The **Preview URL** is the stable URL for a Preview. Think of it as your branch URL — it always points at the latest deployment.
38+
3639
`<preview-name>-<worker-name>.<subdomain>.workers.dev`
3740

38-
Each Preview deployment also gets its own URL, so you can reach a specific immutable deployment directly:
39-
`<deployment-short-id>-<worker-name>.<subdomain>.workers.dev`
41+
The **Deployment URL** is the URL for a specific deployment. Think of it as your commit URL — it is immutable and, once created, always points at that exact deployment.
4042

41-
The Preview URL always points to the latest deployment — you can think of it as your Preview domain. A deployment URL always points to that one specific deployment and never changes, even after you push a new deployment to the Preview.
43+
`<deployment-short-id>-<worker-name>.<subdomain>.workers.dev`
4244

4345
You can also serve Previews from your own **custom domain**. When Previews are enabled on a Worker custom domain, Cloudflare provisions a wildcard DNS record (`*.app.example.com`) and a wildcard certificate to cover all Preview subdomains:
4446

4547
- **Preview URL**: `<preview-name>.app.example.com`
4648
- **Deployment URL**: `<deployment-short-id>-<preview-name>.app.example.com`
4749

48-
Previews can only be reached through these auto-generated URLs and custom domain wildcard URLs.
49-
50-
User-managed triggers like Worker routes, cron triggers, and Queue consumers do not apply to Previews.
50+
Previews can only be reached through these auto-generated URLs and custom domain wildcard URLs. User-managed triggers like [Worker routes](/workers/configuration/routing/routes/), [cron triggers](/workers/configuration/cron-triggers/), and [Queue](/queues/) consumers do not apply to Previews.
5151

5252
For configuration details, see [Use a custom domain for Previews](/workers/previews/#use-a-custom-domain-for-previews).
5353

@@ -61,10 +61,11 @@ Previews are designed so that testing changes does not risk your production data
6161

6262
When your Worker defines the class itself, these binding types give each Preview its own isolated namespace, instances, and storage — separate from production and from every other Preview:
6363

64-
- **Durable Objects**
65-
- **Workflows**
66-
- **Containers** (hosted on Durable Objects)
67-
Concretely, this means:
64+
- [**Durable Objects**](/durable-objects/)
65+
- [**Workflows**](/workflows/)
66+
- [**Containers**](/containers/) (hosted on Durable Objects)
67+
68+
Concretely, this means:
6869
- A Durable Object you reach via `env.MY_DO.getByName("some-id")` in a Preview returns a different instance — with different storage — than the same call in production, and different from the same call in another Preview.
6970
- Writes to `ctx.storage` inside a Preview's Durable Object never affect production data or other Previews.
7071
- State persists across deployments within the same Preview. Pushing a new deployment to the Preview keeps its Durable Object storage intact.
@@ -78,23 +79,23 @@ For Durable Objects and Workflows defined in the same Worker, you can access the
7879

7980
These binding types reference resources that exist at the account level. All Previews pointing at the same resource ID share it with each other and with production (unless you override the ID in `previews`):
8081

81-
- KV
82-
- D1
83-
- R2
84-
- Queues (producers only — Previews cannot consume from Queues)
85-
- Vectorize
86-
- Hyperdrive
87-
- Analytics Engine
88-
- Pipelines
89-
- Secrets Store
90-
- mTLS certificates
91-
- Dispatch namespaces
82+
- [KV](/kv/)
83+
- [D1](/d1/)
84+
- [R2](/r2/)
85+
- [Queues](/queues/) (producers only — Previews cannot consume from Queues)
86+
- [Vectorize](/vectorize/)
87+
- [Hyperdrive](/hyperdrive/)
88+
- [Analytics Engine](/analytics/analytics-engine/)
89+
- [Pipelines](/pipelines/)
90+
- [Secrets Store](/secrets-store/)
91+
- [mTLS certificates](/workers/runtime-apis/bindings/mTLS/)
92+
- [Dispatch namespaces](/cloudflare-for-platforms/workers-for-platforms/)
9293

9394
To keep Preview writes separate from production, create a dedicated resource for Previews and reference it under `previews`, or use [auto-provisioning](/workers/previews/configuring-previews/#auto-provisioning) for KV, D1, and R2.
9495

9596
### Always target production
9697

97-
- **Service bindings** from a Preview always resolve to the bound Worker's production deployment. You cannot point a service binding at another Preview.
98+
- [**Service bindings**](/workers/runtime-apis/bindings/service-bindings/) from a Preview always resolve to the bound Worker's production deployment. You cannot point a service binding at another Preview.
9899

99100
### Scoped to the Preview
100101

src/content/docs/workers/previews/configuring-previews.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,11 @@ This reference example shows all supported binding types in `previews`.
235235

236236
Previews do **not** inherit bindings from your top-level Wrangler configuration. Any binding you want available inside a Preview must be declared in the `previews` block. If you omit a binding here, your Preview will not have access to it at runtime.
237237

238-
For most binding types — such as KV, D1, R2, Queues, Vectorize, and Hyperdrive — all of your Previews share the same underlying resource that you specify in `previews`. These are account-level resources referenced by ID or name, so pointing two Previews at the same `kv_namespaces.id` means they read and write the same data.
238+
For most binding types — such as [KV](/kv/), [D1](/d1/), [R2](/r2/), [Queues](/queues/), [Vectorize](/vectorize/), and [Hyperdrive](/hyperdrive/) — all of your Previews share the same underlying resource that you specify in `previews`. These are account-level resources referenced by ID or name, so pointing two Previews at the same `kv_namespaces.id` means they read and write the same data.
239239

240240
If you need a Preview's writes to stay separate from production, create a dedicated resource for Previews, or use [auto-provisioning](#auto-provisioning) for KV, D1, and R2.
241241

242-
The exceptions are **Durable Objects**, **Workflows**, and **Containers**. When your Worker defines the class itself (no `script_name` on the binding), each Preview automatically gets its own isolated namespace and instances, separate from production and from other Previews. State persists across deployments within the same Preview and is deleted when the Preview is deleted. If you set `script_name` to point at another Worker, the binding targets that Worker's production instance and this isolation does not apply — prefer [`ctx.exports`](/workers/runtime-apis/context/#exports) for Durable Objects and Workflows defined in the same Worker.
242+
The exceptions are [**Durable Objects**](/durable-objects/), [**Workflows**](/workflows/), and [**Containers**](/containers/). When your Worker defines the class itself (no `script_name` on the binding), each Preview automatically gets its own isolated namespace and instances, separate from production and from other Previews. State persists across deployments within the same Preview and is deleted when the Preview is deleted. If you set `script_name` to point at another Worker, the binding targets that Worker's production instance and this isolation does not apply — prefer [`ctx.exports`](/workers/runtime-apis/context/#exports) for Durable Objects and Workflows defined in the same Worker.
243243

244244
[Service bindings](/workers/runtime-apis/bindings/service-bindings/) behave differently from both: they always resolve to the bound Worker's production deployment, and cannot be pointed at another Worker's Preview.
245245
| `previews` field | How it behaves |
@@ -314,12 +314,12 @@ Some `previews` fields are not runtime bindings, but they still change how new P
314314
| `define` | Changes compile-time replacements for the Preview build. It does not create a runtime binding. |
315315
Some Preview-related settings come from the top level of your Wrangler config, not from `previews`:
316316

317-
- `compatibility_date`
318-
- `compatibility_flags`
319-
- `placement`
320-
- `assets`
321-
- `migrations`
322-
- `containers`
317+
- [`compatibility_date`](/workers/configuration/compatibility-dates/)
318+
- [`compatibility_flags`](/workers/configuration/compatibility-flags/)
319+
- [`placement`](/workers/configuration/smart-placement/)
320+
- [`assets`](/workers/static-assets/)
321+
- [`migrations`](/durable-objects/reference/durable-objects-migrations/)
322+
- [`containers`](/containers/)
323323

324324
## Use environment-specific Preview defaults
325325

src/content/docs/workers/previews/index.mdx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ You create or update a Preview by:
1818

1919
Each Preview has two kinds of **URLs**:
2020

21-
- A stable **Preview URL** that always points at the latest deployment.
22-
- A **Deployment URL** for each individual deployment, which is immutable and never changes.
23-
When you connect your Git repository, Cloudflare posts these URLs on your pull requests as a comment. By default, Previews are served from your `workers.dev` subdomain. You can also route them through a [custom domain](/workers/previews/#use-a-custom-domain-for-previews).
21+
- A **Preview URL** that points at the latest deployment. Think of it as your branch URL — it always serves whatever you pushed most recently.
22+
- A **Deployment URL** for each individual deployment. Think of it as your commit URL — it is immutable and never changes.
23+
24+
When you connect your Git repository, Cloudflare posts these URLs on your pull requests as a comment. By default, Previews are served from your `workers.dev` subdomain. You can also route them through a [custom domain](/workers/previews/#use-a-custom-domain-for-previews).
2425

2526
## Getting started
2627

0 commit comments

Comments
 (0)