Cloudflare introduced Worker Previews, a capability that automatically creates a separate, production‑like deployment for every pull request made to a Workers project. This gives engineers a safe way to run code, test bindings, and observe behavior without affecting the live service.
Configuring Isolated Previews
Previews are defined in the previews section of the Wrangler configuration file. Within this block you can set initial variables, bindings, and other settings that each preview inherits. Secrets are added through standard Wrangler commands, allowing a single preview to diverge from production or other previews without altering shared configuration.
Resource Isolation and Observability
When a preview uses Durable Objects or Containers, Cloudflare provisions distinct namespaces, storage, and runtime instances for that preview. The same isolation model applies to KV, D1, R2, or any account‑level resource that is explicitly bound to the preview. Each preview maintains its own logs, error streams, metrics, and trace data, so troubleshooting can be performed in isolation from production traffic.
CI/CD Integration and URL Management
Starting with Wrangler 4.135.0, developers can launch a preview locally with npx wrangler preview. In addition, connecting a repository to Workers Builds enables automatic preview creation on every push, with the preview URL posted back to the pull request. Every preview receives a stable URL that updates on each push, while each individual deployment also gets an immutable URL for exact version comparison.
npx wrangler preview
Related CloudNinjas coverage: hands-on guides.
What This Means For Practitioners
Adopt the previews block in your Wrangler config to guarantee that each change is evaluated in a sandbox that mirrors production. Treat bindings to external resources as an explicit decision point—binding a preview to a separate KV or D1 instance prevents accidental data leakage. Incorporate preview URLs into code‑review workflows so reviewers can validate behavior before merging. Finally, monitor the additional resource usage that isolated namespaces introduce and adjust CI pipelines to clean up stale previews if needed.

