Preview URLs
BetaPreview URLs allow you to preview new versions of your Worker without deploying it to production.
Every time you create a new version of your Worker a unique preview URL is generated. Preview URLs take the format: <VERSION_PREFIX>-<WORKER_NAME>.<SUBDOMAIN>.workers.dev
. New versions of a Worker are created on wrangler deploy
, wrangler versions upload
or when you make edits on the Cloudflare dashboard. By default, preview URLs are enabled and available publicly.
Preview URLs can be:
- Integrated into CI/CD pipelines, allowing automatic generation of preview environments for every pull request.
- Used for collaboration between teams to test code changes in a live environment and verify updates.
- Used to test new API endpoints, validate data formats, and ensure backward compatibility with existing services.
When testing zone level performance or security featues for a version, we recommended using version overrides so that your zone's performance and security settings apply.
The wrangler versions upload
command uploads a new version of your Worker and returns a preview URL for each version uploaded.
- Log in to the Cloudflare dashboard ↗ and select your project.
- Head to the "Deployments" tab find the version you would like to view.
By default, preview URLs are enabled and available publicly. You can use Cloudflare Access to require visitors to authenticate before accessing preview URLs. You can limit access to yourself, your teammates, your organization, or anyone else you specify in your access policy.
To limit your preview URLs to authorized emails only:
- Log in to the Cloudflare Access dashboard ↗.
- Select your account.
- Add an application.
- Select Self Hosted.
- Name your application (for example, "my-worker") and add your
workers.dev
subdomain as the Application domain.
For example, if you want to secure preview URLs for a Worker running on my-worker.my-subdomain.workers.dev
.
- Subdomain:
*-my-worker
- Domain:
my-subdomain.workers.dev
- Go to the next page.
- Add a name for your access policy (for example, "Allow employees access to preview URLs for my-worker").
- In the Configure rules section create a new rule with the Emails selector, or any other attributes which you wish to gate access to previews with.
- Enter the emails you want to authorize. View access policies to learn about configuring alternate rules.
- Go to the next page.
- Add application.
Preview URLs run on your workers.dev
subdomain. To make preview URLs inaccessible, you must disable your Workers workers.dev
subdomain. Learn how to disable your Workers workers.dev
subdomain.
- Preview URLs are not generated for Workers that implement a Durable Object.
- Preview URLs are not currently generated for Workers for Platforms 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
.