INTEGRITY Cloudflare Docs

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:

Both preview URL types follow the format: <VERSION_PREFIX OR ALIAS>-<WORKER_NAME>.<SUBDOMAIN>.workers.dev.

Preview URLs can be:

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.

Types of Preview URLs

Versioned Preview URLs

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:

If Preview URLs have been enabled, they are public and available immediately after version creation.

View versioned preview URLs using Wrangler

The wrangler versions upload command uploads a new version of your Worker and returns a preview URL for each version uploaded.

View versioned preview URLs on the Workers dashboard

  1. In the Cloudflare dashboard, go to the Workers & Pages page.

    Go to Workers & Pages ↗
  2. Select your Worker.

  3. Go to the Deployments tab, and find the version you would like to view.

Aliased preview URLs

Aliased preview URLs let you assign a persistent, readable alias to a specific Worker version. These are useful for linking to stable previews across many versions (e.g. to share an upcoming but still actively being developed new feature). A common workflow would be to assign an alias for the branch that you're working on. These types of preview URLs follow the same pattern as other preview URLs: <ALIAS>-<WORKER_NAME>.<SUBDOMAIN>.workers.dev

Create an Alias

Aliases may be created during versions upload, by providing the --preview-alias flag with a valid alias name:

wrangler versions upload --preview-alias staging

The resulting alias would be associated with this version, and immediately available at: staging-<WORKER_NAME>.<SUBDOMAIN>.workers.dev

Rules and limitations

Manage access to Preview URLs

When enabled, Preview URLs are available publicly. To require visitors to sign in before they can access Preview URLs, use Cloudflare Access.

Access can protect previews for one Worker or every Worker in an account. You can also protect both production and preview deployments.

To use details about the signed-in user in your Worker, read the user's identity from the validated JWT or the /cdn-cgi/access/get-identity endpoint.

Toggle Preview URLs (Enable or Disable)

Note:

From the Dashboard

To toggle Preview URLs for a Worker:

  1. In the Cloudflare dashboard, go to the Workers & Pages page.

    Go to Workers & Pages ↗
  2. In Overview, select your Worker.

  3. Go to Settings > Domains & Routes.

  4. For Preview URLs, click Enable or Disable.

  5. Confirm your action.

From the Wrangler configuration file

To toggle Preview URLs for a Worker, include any of the following in your Worker's Wrangler file:

{
	"preview_urls": true
}
preview_urls = true
{
	"preview_urls": false
}
preview_urls = false

If not given, preview_urls = workers_dev is the default.

Limitations