Skip to content

Adds docs for Worker Previews #28806

Draft
korinne wants to merge 8 commits intoproductionfrom
korinne/worker-previews
Draft

Adds docs for Worker Previews #28806
korinne wants to merge 8 commits intoproductionfrom
korinne/worker-previews

Conversation

@korinne
Copy link
Copy Markdown
Contributor

@korinne korinne commented Mar 6, 2026

Summary

Draft documentation for Worker Previews

To dos

  • Needs actual API docs
  • Add Terraform resources
  • Audit / clean up old Preview URLs docs
  • Add details about wrangler secret put for previews
  • Add a nice diagram

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 6, 2026

This PR requires additional review attention because it affects the following areas:

Partials

This PR updates partial files, which are pieces of content used across multiple files in our Render component.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 6, 2026

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/public/__redirects @cloudflare/content-engineering, @cloudflare/pcx-technical-writing
/src/content/changelog/ @cloudflare/pm-changelogs, @cloudflare/pcx-technical-writing
/src/content/docs/workers/ci-cd/ @irvinebroque, @aninibread, @GregBrimble, @cloudflare/pcx-technical-writing, @yomna-shousha
/src/content/docs/workers/ @cloudflare/workers-docs, @GregBrimble, @irvinebroque, @mikenomitch, @korinne, @WalshyDev, @cloudflare/deploy-config, @cloudflare/pcx-technical-writing, @cloudflare/wrangler, @mattietk, @cloudflare/dev-plat-leads
/src/content/docs/workers/static-assets @irvinebroque, @GregBrimble, @WalshyDev, @cloudflare/deploy-config, @cloudflare/pcx-technical-writing
/src/content/docs/workers/wrangler/ @cloudflare/wrangler, @irvinebroque, @cloudflare/pcx-technical-writing
/src/content/partials/workers/ @cloudflare/workers-docs, @GregBrimble, @irvinebroque, @mikenomitch, @WalshyDev, @cloudflare/deploy-config, @cloudflare/pcx-technical-writing, @cloudflare/wrangler, @mattietk

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 6, 2026

Preview URL: https://e3ccd4f9.preview.developers.cloudflare.com
Preview Branch URL: https://korinne-worker-previews.preview.developers.cloudflare.com

Files with changes (up to 15)

Original Link Updated Link
https://developers.cloudflare.com/workers/previews/api/ https://korinne-worker-previews.preview.developers.cloudflare.com/workers/previews/api/
https://developers.cloudflare.com/workers/previews/ https://korinne-worker-previews.preview.developers.cloudflare.com/workers/previews/
https://developers.cloudflare.com/workers/configuration/previews/ https://korinne-worker-previews.preview.developers.cloudflare.com/workers/configuration/previews/
https://developers.cloudflare.com/workers/static-assets/migration-guides/migrate-from-pages/ https://korinne-worker-previews.preview.developers.cloudflare.com/workers/static-assets/migration-guides/migrate-from-pages/
https://developers.cloudflare.com/changelog/2025-09-17-update-preview-url-setting/ https://korinne-worker-previews.preview.developers.cloudflare.com/changelog/2025-09-17-update-preview-url-setting/
https://developers.cloudflare.com/changelog/2025-10-23-preview-url-default-behavior/ https://korinne-worker-previews.preview.developers.cloudflare.com/changelog/2025-10-23-preview-url-default-behavior/
https://developers.cloudflare.com/changelog/2025-04-08-deploy-to-cloudflare-button/ https://korinne-worker-previews.preview.developers.cloudflare.com/changelog/2025-04-08-deploy-to-cloudflare-button/
https://developers.cloudflare.com/changelog/2025-08-08-support-long-branch-names-preview-aliases/ https://korinne-worker-previews.preview.developers.cloudflare.com/changelog/2025-08-08-support-long-branch-names-preview-aliases/
https://developers.cloudflare.com/changelog/2025-10-03-one-click-access-for-workers/ https://korinne-worker-previews.preview.developers.cloudflare.com/changelog/2025-10-03-one-click-access-for-workers/
https://developers.cloudflare.com/changelog/2025-10-30-builds-preview/ https://korinne-worker-previews.preview.developers.cloudflare.com/changelog/2025-10-30-builds-preview/
https://developers.cloudflare.com/workers/ci-cd/builds/build-branches/ https://korinne-worker-previews.preview.developers.cloudflare.com/workers/ci-cd/builds/build-branches/
https://developers.cloudflare.com/workers/ci-cd/builds/configuration/ https://korinne-worker-previews.preview.developers.cloudflare.com/workers/ci-cd/builds/configuration/
https://developers.cloudflare.com/workers/ci-cd/builds/git-integration/github-integration/ https://korinne-worker-previews.preview.developers.cloudflare.com/workers/ci-cd/builds/git-integration/github-integration/
https://developers.cloudflare.com/workers/ci-cd/builds/git-integration/gitlab-integration/ https://korinne-worker-previews.preview.developers.cloudflare.com/workers/ci-cd/builds/git-integration/gitlab-integration/
https://developers.cloudflare.com/workers/ci-cd/builds/ https://korinne-worker-previews.preview.developers.cloudflare.com/workers/ci-cd/builds/

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 6, 2026

CI run failed: build logs

- Preview URLs are not currently generated for [Workers for Platforms](/cloudflare-for-platforms/workers-for-platforms/) [user Workers](/cloudflare-for-platforms/workers-for-platforms/how-workers-for-platforms-works/#user-workers). This is a temporary limitation, we are working to remove it.
- You cannot currently configure Preview URLs to run on a subdomain other than [`workers.dev`](/workers/configuration/routing/workers-dev/).
- You cannot view logs for Preview URLs today, this includes Workers Logs, Wrangler tail and Logpush.
This page has moved. For the latest documentation on Previews, refer to [Previews](/workers/previews/).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this page is no longer reachable because of the redirect, no? should we just delete this file?


### From the dashboard

Go to your Worker > **Settings**, and you will see a banner for setting up your default Preview settings. This walks you through the bindings, environment variables, and [observability](#observability-and-logging) settings you want every Preview to start with. This is the fastest way to get your whole team set up — anyone who creates a Preview (manually or by pushing a branch) gets the same configuration without needing to specify it themselves.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This banner will only appear if the Worker already has production bindings (and will likely be removed or retooled before we launch). Brand new Workers won't require any unique setup flows for Previews; configuring a Worker with Previews settings is just like configuring a Worker with Production settings. In other words, we should just point users to configuring their Previews settings from the Settings and Bindings tabs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty skeptical of the value of this page. The important reference information will already be captured by our actual API reference docs (and OpenAPI schema), and the high-level feature concept explanations don't belong in a page focused on interacting with the API. Topics like how settings provided at deployment time interact with Previews settings probably shouldn't be presented through the narrow lens of the API.

We don't document other APIs in this way. Why Previews? If it's to aid in agent discoverability, I think API reference docs (or just relying on wrangler commands instead of making API requests directly) will suffice.

InlineBadge,
} from "~/components";

A **Preview** is an isolated copy of your Worker that runs on its own URL, so you can test changes before deploying to production. A Worker can have many Previews running at the same time, each isolated from each other. Each Preview runs with its own [bindings](/workers/runtime-apis/bindings/), [environment variables](/workers/configuration/environment-variables/), and [secrets](/workers/configuration/secrets/), so your preview traffic never touches your production data.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
A **Preview** is an isolated copy of your Worker that runs on its own URL, so you can test changes before deploying to production. A Worker can have many Previews running at the same time, each isolated from each other. Each Preview runs with its own [bindings](/workers/runtime-apis/bindings/), [environment variables](/workers/configuration/environment-variables/), and [secrets](/workers/configuration/secrets/), so your preview traffic never touches your production data.
A **Preview** is a separate instance of your Worker that runs on its own URL, so you can test changes before deploying to production. Previews run with their own set of [bindings](/workers/runtime-apis/bindings/), [environment variables](/workers/configuration/environment-variables/), and [secrets](/workers/configuration/secrets/), so your preview traffic never touches your production data.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A Worker can have many Previews running at the same time, each isolated from each other

This is only true insofar as two Previews don't share the same binding configuration. This isn't a claim we can reliably make.

git checkout -b new-feature
```

3. Deploy a Preview:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably include git push as an option here (assuming the user has connected this Worker to their git repo in the interim...)

I wonder if a "quick start" focused on Previews is actually valuable. Previews are a means to and end of supporting the overall SDLC of your Workers application, not the destination itself.

| Preview | `my-feature.app.example.com` |
| Deployment | `f498jo-my-feature.app.example.com` |

To enable Previews on a custom domain via the API, set `previews_enabled` to `true`:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels out-of-place to show how to do this via API.


## Secure access to Previews

To restrict who can access your Preview URLs, you can enable [Cloudflare Access](/cloudflare-one/access-controls/policies/) with a single click in your Worker's settings. This protects both Preview URLs and Deployment URLs.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To restrict who can access your Preview URLs, you can enable [Cloudflare Access](/cloudflare-one/access-controls/policies/) with a single click in your Worker's settings. This protects both Preview URLs and Deployment URLs.
To restrict who can access your Previews, you can enable [Cloudflare Access](/cloudflare-one/access-controls/policies/) with a single click in your Worker's settings. This protects both Preview URLs and Deployment URLs.

To restrict who can access your Preview URLs, you can enable [Cloudflare Access](/cloudflare-one/access-controls/policies/) with a single click in your Worker's settings. This protects both Preview URLs and Deployment URLs.

1. Go to **Workers & Pages** > your Worker > **Settings** > **Domains & Routes**.
2. For Preview URLs, select **Enable Cloudflare Access**.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
2. For Preview URLs, select **Enable Cloudflare Access**.
2. Select **Enable Cloudflare Access** within the actions menu of **Preview URLs**.


## Observability and logging

Each Preview runs its own observability and logging settings, independent of your production Worker. This means you can:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Each Preview runs its own observability and logging settings, independent of your production Worker. This means you can:
Each Preview has its own observability and logging settings, independent of your production Worker. This means you can:

- Enable [Logpush](/workers/observability/logpush/) to send a Preview's logs to your own storage for debugging.
- Attach [Tail Workers](/workers/observability/logs/tail-workers/) to a Preview to pipe its logs into a custom analysis pipeline.

Configure these in the dashboard under **Workers & Pages** > your Worker > **Settings** > **Preview Defaults**, and Cloudflare applies them to every Preview created for that Worker. For details on how observability settings are structured, refer to the [Preview object](/workers/previews/api/#preview-object).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Configure these in the dashboard under **Workers & Pages** > your Worker > **Settings** > **Preview Defaults**, and Cloudflare applies them to every Preview created for that Worker. For details on how observability settings are structured, refer to the [Preview object](/workers/previews/api/#preview-object).
Configure observability settings for all Previews in the dashboard under **Workers & Pages** > your Worker > **Settings** > **Observability**. You can also configure these settings for an individual Preview under **Workers & Pages** > your Worker > **Previews** > your Preview > **Settings**.

Comment on lines +109 to +119
Run `wrangler preview` from your project directory to build your code locally and deploy it as a Preview:

<PackageManagers type="exec" pkg="wrangler" args="preview" />

By default, Wrangler names the Preview after your current Git branch. You can also provide a name explicitly:

<PackageManagers type="exec" pkg="wrangler" args="preview --name my-feature" />

If a Preview with that name does not exist yet, Wrangler creates it. If it already exists, Wrangler creates a new deployment within it. Each time you run `wrangler preview`, Wrangler prints the Preview URL and Deployment URL to your terminal.

Use this for ad-hoc testing, external CI/CD pipelines, or when you are not using a Git-based workflow.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Run `wrangler preview` from your project directory to build your code locally and deploy it as a Preview:
<PackageManagers type="exec" pkg="wrangler" args="preview" />
By default, Wrangler names the Preview after your current Git branch. You can also provide a name explicitly:
<PackageManagers type="exec" pkg="wrangler" args="preview --name my-feature" />
If a Preview with that name does not exist yet, Wrangler creates it. If it already exists, Wrangler creates a new deployment within it. Each time you run `wrangler preview`, Wrangler prints the Preview URL and Deployment URL to your terminal.
Use this for ad-hoc testing, external CI/CD pipelines, or when you are not using a Git-based workflow.
Run `wrangler preview` from your project directory to build your code locally and deploy it as a Preview. Use this for ad-hoc testing, external CI/CD pipelines, or when you are not using a Git-based workflow.
<PackageManagers type="exec" pkg="wrangler" args="preview" />
By default, Wrangler names the Preview after your current Git branch. You can also provide a name explicitly:
<PackageManagers type="exec" pkg="wrangler" args="preview --name my-feature" />

@github-actions
Copy link
Copy Markdown
Contributor

Hey there, we've marked this pull request as stale because there's no recent activity on it. This label is helps us identify PRs that might need updates (or to be closed out by our team if no longer relevant).

@github-actions github-actions bot added the stale label Mar 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants