
Cloudflare's September 22 Worker Previews give every Git branch its own isolated Worker environment, Durable Objects and Containers included, while KV, D1, and R2 stay shared until you re-bind them.
npx wrangler preview gives each Git branch its own isolated, production-like environment under the same Worker — its own code, configuration, URL, observability, and state. 1previews block in your Wrangler configuration, so everything the Worker reads has to be declared there. And a preview binding that names a production resource reads and writes production data, so the isolation you get is exactly the isolation you configure. 34| Aspect | Before September 22, 2026 | Current behavior | Action, and when |
|---|---|---|---|
| A branch's environment | Preview URLs pointed at one uploaded version of your code, running on production resources | npx wrangler preview creates or updates a Preview for the current branch, under the same Worker, with its own code, configuration, URL, observability, and state | Run it on the next branch you review. This week 2 |
| The old preview workflow | Aliased Version URLs served branch and pull-request previews | Those are now Version URLs, kept for inspecting one uploaded version ahead of a production deploy, and they still run on production resources | Move branch previews onto npx wrangler preview. Before your next pull request 5 |
| Durable Objects and Containers | A preview sharing the production namespace could reach the instance serving live traffic | Every Preview gets a new Durable Object namespace with its own storage, plus its own container app and instances, provisioned automatically | Automatic; declare the binding under previews when your code reads it from env 4 |
| KV, D1, R2, Queues, and the rest | No isolation between previews | Two Previews that name the same namespace, database, or bucket share its data, and a Preview bound to a production resource uses production data | Point every preview binding at a staging or test resource. Before the first Preview you let write 4 |
| Configuration and secrets | Production settings only | A Preview starts from the base configuration in your previews block; base secrets reach new Previews, and one Preview can be overridden on its own | Write the previews block on main, then override per branch as needed 3 |
| Wrangler | Any current version | Worker Previews requires Wrangler 4.135.0 or later | Upgrade the project dependency, which project commands use in place of a newer global install. Before the first wrangler preview 2 |
| Access to a Preview URL | The same, and preview URLs were equally public | Preview URLs are public by default, with count limits on Previews and deployments per Worker | Put Cloudflare Access in front when a Preview shows private data. Before you share a URL 2 |
npx wrangler deploy on main, you run npx wrangler preview on a branch, and Wrangler creates or updates a Preview for that branch under the same Worker. 2my-worker-staging. A Preview can run inside one of them, configured at env.staging.previews, which gives you a persistent boundary and branch isolation together. 5| Resource or setting | How a Preview binds it | To isolate one Preview |
|---|---|---|
| Durable Objects | Cloudflare provisions a new namespace and storage for each Preview | Automatic 4 |
| Containers | Cloudflare provisions a new container app and container instances for each Preview | Automatic; declare the container under previews.containers so Wrangler builds that Preview's image 4 |
| KV | By namespace id | Bind a different namespace 4 |
| D1 | By database_id, so two Previews naming it share rows | Bind a different database, and apply the branch's migrations to it first 4 |
| R2 | By bucket_name | Bind a different bucket 4 |
| Queues producers | By queue name | Bind a different queue 4 |
| Workflows | By binding to an existing Workflow, whose deployed code, bindings, and instances the calls use | Bind a dedicated non-production Workflow 4 |
| Vectorize, Hyperdrive, Analytics Engine, Pipelines, Secrets Store, Workers for Platforms | By index name, configuration id, dataset name, stream id, store and secret name, or namespace | Bind a different resource of each kind 4 |
ctx.exports and the enable_ctx_exports compatibility flag, which is on by default from compatibility date 2025-11-17, exporting the class and its migration is enough: ctx.exports.Counter resolves to the production namespace in production and to that Preview's namespace inside a Preview. A Worker that reads the binding from env needs the same binding declared under previews.durable_objects.bindings. 4
fix-button bound to a staging D1 database, d1-migration to a test one, new-feature carrying an extra R2 binding, and each holding its own Durable Object state cylinder. The note at top right marks the Durable Object namespaces as provisioned automatically. Source: Cloudflare Workers docs, Previews — resources and isolation.previews block. 23assets and compatibility_date stay at the top level. npx wrangler preview uploads assets from the branch you are previewing, while define and tail_consumers need their own entries under previews to reach the Preview. 3npx wrangler containers list. Cloudflare's guidance is to check that list after a delete and remove leftovers by application ID. 4app.preview.example.com produces Preview URLs beneath that name, deeper hostnames can need Advanced Certificate Manager with Total TLS, and Cloudflare suggests a dedicated hostname such as previews.example.com to avoid wildcard conflicts with your production subdomains. 7previews block is required in your Wrangler configuration, and it can be empty when a Preview needs no separate settings. Write it on the branch your team branches from, such as main, because Git carries the configuration file into each new branch and npx wrangler preview treats the configuration on the current branch as the source of truth. 3Production toggle and a Previews Base toggle. You can import names and values from production and then edit them, and secret values have to be entered again by hand. 3| I want to | Command |
|---|---|
| Add a secret to the base configuration | npx wrangler preview base-config secret put SECRET_NAME |
| Add a secret to one Preview | npx wrangler preview secret put SECRET_NAME --name <preview> |
| Remove a secret from the base configuration | npx wrangler preview base-config secret delete SECRET_NAME |
| Remove a secret from one Preview | npx wrangler preview secret delete SECRET_NAME --name <preview> |
--name flag defaults to the current Git branch. A change to a base secret reaches new Previews, while active Previews keep the value they were created with. 3npx wrangler preview; Cloudflare then creates the Preview and comments its URL on the pull request. 8npx wrangler preview --name "pr-${{ github.event.pull_request.number }}" --json, reads the URL out of .preview.urls[0], and posts it as a pull-request comment, with a probe step that follows using curl --fail against a health route. The token needs permission to edit Workers Scripts plus the resources the Preview uses, and the examples ask the job to confirm that a pull request came from your own repository before it uses those credentials. 8closed action and running npx wrangler preview delete --name "pr-<number>" --skip-confirmation removes the Preview when the review ends. 8 In a monorepo, Preview names are scoped to a Worker, so two Workers can each hold a Preview named pr-123, while a service binding between those two Previews still resolves to production. 8
Production holds the live values, and Previews Base holds the values every new Preview starts from. Source: Cloudflare Workers docs, Previews — configuration.npx wrangler preview delete --name. 2X-Robots-Tag: noindex header to workers.dev Preview URLs automatically, and expects you to add that header yourself on custom-domain Preview URLs, through a _headers file for static assets or in the Worker's own code. 7 For real privacy, Cloudflare Access can cover every Preview on the account, one Worker's Previews, or specific hostnames. 2npx wrangler preview unavailable. 2previews block on main, with vars and every storage or data binding the Worker needs, each pointed at a staging or test resource. Leave Durable Objects and Containers to automatic isolation, and add previews.containers when the Worker runs a container. 3npx wrangler preview, comments the URL, and probes one route that exercises the change. 8npx wrangler containers list after the first deletion if the Worker runs a container. 48workers.dev for the automatic noindex header, or add a custom domain and put Cloudflare Access in front of hostnames that expose real data. 7previews block plus one command, and it leaves production untouched. 45main with you as the only reviewer, where a second environment has little to prove.developers.cloudflare.com
developers.cloudflare.com
developers.cloudflare.com
developers.cloudflare.com
developers.cloudflare.com
blog.cloudflare.com
developers.cloudflare.com
developers.cloudflare.com
developers.cloudflare.com
This story was produced automatically by a channel. One sentence is all it takes for Neodrop to keep producing for you.