GuidePlatforms & Tools

How to test a Cloudflare Worker with a Version URL

Upload a build and test a few targeted requests before routing visitors to it. Check what the version can access and document when it is ready.

Two overlapping browser panels frame an indigo cursor and a teal preview tile.
On this page

A Cloudflare Workers change can be ready to test before it is ready to handle a visitor. Upload a version, open its Version URL and try the handful of requests that would expose a bad change. The Cloudflare Version URLs documentation explains the important boundary: that link runs the uploaded version using its configured resources. Work on a production Worker can therefore touch production data even while the live route continues to serve an earlier version.

Decide which test can use the real bindings

Choose one or two behaviours you can check without changing data. For a site with an archive generated by a Worker, useful checks include a known article returning the right template, a missing article returning the intended response, and the menu linking to the correct path. Use pages whose expected output you can describe in a line. That gives a teammate an independent way to verify the result instead of asking whether the new build merely looks right.

A different test is needed for anything that places an order, creates a comment, sends an email or updates an account. The Cloudflare Previews documentation describes a branch and pull-request workflow with its own variables, secrets and bindings. Check which resources are actually isolated before running a write against any test address. A test link by itself says nothing about whether an underlying database, bucket or service can receive a real change.

Create a version without promoting it

Confirm the project and Worker name before you use your terminal. The Versions & deployments overview separates an upload from a deployment: uploading can create a version without changing where traffic goes. The ordinary wrangler deploy workflow publishes the new version to all traffic, according to Cloudflare. For this check, run npx wrangler versions upload from the intended project instead. With Version URLs enabled, the returned address identifies the uploaded version. Save it with the version ID and the change you expect to see.

You can find the version in the dashboard under Workers & Pages > your Worker > Deployments. If the version exists but the link is missing or disabled, open Settings > Domains & Routes > Version URLs for that Worker. The Wrangler setting still uses the name preview_urls. Cloudflare's version-link documentation explains that an explicit value changes the setting, while leaving it out does not change an existing setting. Changing it may affect who can reach an uploaded version, so confirm your team's access decision before enabling it.

Make access a deliberate choice

Cloudflare says enabled Version URLs are public unless Cloudflare Access is used to require sign-in. Decide who should be able to test the version and use an access method that matches that decision. When a colleague should be able to open the link, test with their permitted account as well as an unauthenticated session to confirm the boundary you intended. A reviewer who cannot open the page needs the approved access path. Copying the link into another channel changes who receives it without changing the protection.

Use the version ID in your review note even if your team gives the URL a readable alias. Cloudflare allows alias creation during upload, and an alias stops working if its version is deleted. A name such as staging can be easy to recognize while still pointing to a version that uses production resources. Give the note both identities, record the exact test date and keep a short description of the resources the test may contact. That information matters when someone resumes a review days later.

Compare the same requests and write down differences

Open the same article path against the Version URL and the public site so you can separate the intended change from the existing baseline. Record the status code, visible page title and navigation you expected, then check whether the candidate actually produces them. If the Worker handles redirects, compare both the initial response and the final destination. A clean browser profile can also help distinguish the page from a cached asset, a distinction that matters when checking stale site images.

A Version URL uses a workers.dev hostname, and Cloudflare recommends version overrides when you specifically need to test a zone's performance or security settings. Keep hostname-sensitive tests separate from what you can conclude from the direct version link. When the intended change depends on a custom domain, capture that dependency in the release note. A direct request can confirm the uploaded version serves the expected output, while the zone's full production path requires its own evidence.

Make promotion a separate decision

Before you change live traffic, write down the version you checked, the read-only cases that passed and any behaviour that still needs testing on the deployed route. Use the Cloudflare deployment management documentation when choosing how to promote it. Cloudflare distinguishes manual deployment from gradual deployment, which splits traffic between versions. Choose a review point after the change where someone can repeat the essential checks using the public hostname. For example, if a graceful error page was the reason for the release, open a known missing URL after promotion and confirm that the public response still has the intended status as well as the new design.

Record the currently serving version before promotion, just as a site update with a rollback plan records the last working state. In Workers, version history tracks code and configuration, but Cloudflare says changes to storage such as KV, R2 or D1 are outside that history. Keep data recovery decisions separate. End the review with a short record of what this version proved, what the production route still needs to prove and who is responsible for checking each one.

Platforms coveredCloudflare