Preview URLs
Preview URLs allow you to preview new versions of your Worker without deploying it to production.
There are two types of preview URLs:
- Version-Prefixed Preview URLs: A unique URL generated automatically for each new version of your Worker.
- Alias Preview URLs: A static, human-readable alias that you can manually assign to a Worker version.
Both preview URL types follow the format: <VERSION_PREFIX OR ALIAS>-<WORKER_NAME>.<SUBDOMAIN>.workers.dev
.
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 features for a version, we recommend using version overrides so that your zone's performance and security settings apply.
Every time you create a new version of your Worker, a unique static version preview URL is generated automatically. These URLs use a version prefix and follow the format <VERSION_PREFIX>-<WORKER_NAME>.<SUBDOMAIN>.workers.dev
.
New versions of a Worker are created when you run:
wrangler deploy
wrangler versions upload
- Or when you make edits via the Cloudflare dashboard
These URLs are public by default and available immediately after version creation.
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.
- Go to the Deployments tab, and find the version you would like to view.
Aliased preview URLs let you assign a persistent, readable alias to a specific Worker version. These are useful for linking to stable previews across environments. These types of preview URLs follow the same pattern as other preview URLs:
<ALIAS>-<WORKER_NAME>.<SUBDOMAIN>.workers.dev
Aliases may be created by explicitly defining setting an alias during a versions upload
:
wrangler versions upload --alias staging
The resulting alias would be associated with this version, and immediately available at:
staging-<WORKER_NAME>.<SUBDOMAIN>.workers.dev
- Aliases may only be created during version upload.
- Aliases must use only lowercase letters and numbers.
- The alias and Worker name combined (with a dash) must not exceed 63 characters due to DNS label limits.
- Only the 50 most recently used aliases are retained. When a new alias is created beyond this limit, the least recently used alias is deleted.
By default, all 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.
Disabling Preview URLs will disable routing to both version-prefixed and aliased URLs.
To disable Preview URLs for a Worker:
- Log in to the Cloudflare dashboard ↗ and select your account.
- Go to Workers & Pages and in Overview, select your Worker.
- Go to Settings > Domains & Routes.
- On "Preview URLs" click "Disable".
- Confirm you want to disable.
Disabling Preview URLs in the Wrangler configuration file
To disable Preview URLs for a Worker, include the following in your Worker's Wrangler file:
{ "preview_urls": false}
preview_urls = false
When you redeploy your Worker with this change, Preview URLs will be disabled.
- 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
.
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Products
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark