You can now test every change you make in an isolated, production-like environment with Worker Previews ↗. Each Preview runs under the same Worker with its own code, configuration, URL, and observability, isolated from production and every other Preview.
Define the variables, bindings, and settings that new Previews start with in the previews block of your Wrangler configuration file. Set secrets with Wrangler commands. You can override one Preview without changing production or other Previews.
For Durable Objects and Containers, Cloudflare automatically provisions separate namespaces, storage, apps, and instances for every Preview. State changes, sessions, memory, migrations, and concurrent tests remain scoped to that Preview. To isolate KV, D1, R2, or another account-level resource, bind the Preview to a separate resource.

Use Wrangler 4.135.0 or later to deploy a Preview:
npx wrangler preview
Or connect your repository to Workers Builds to create Previews automatically and post their URLs to pull requests.
Each Preview gets a stable URL that updates with every push, so reviewers always see the latest changes. Each deployment also gets an immutable URL, so you can compare or return to an exact version.
After you create a Preview, use the environment breadcrumb next to your Worker’s name to switch between Production and every Preview:

Each Preview has its own logs, errors, metrics, and traces. Send traffic to its URL, inspect what happened, push a fix, and verify the next deployment before production.

Serve Preview URLs on workers.dev, a custom domain, or both. Custom domains let authentication providers, cookies, cross-origin resource sharing (CORS), and OAuth redirects work as they will in production. You can also protect Preview URLs with Cloudflare Access.
Configure a domain for Preview traffic from the Worker’s Domains tab:

For setup instructions and current limitations, refer to the Worker Previews documentation.
Source: Cloudflare


