Migrate from Pages to Workers·续
name = "my-worker"
# Set this to today's date
compatibility_date = "2026-10-27"
main = "./worker/index.ts"
upload_source_maps = true
preview_urls = true
previews = { }
[assets]
directory = "./dist/client/"
```
2. [Enable preview builds](https://developers.cloudflare.com/workers/ci-cd/builds/build-branches/#configure-preview-builds) in Workers Builds.
3. If an existing Workers Builds project still uses the previous preview model, complete the [one-time switch to Worker Previews](https://developers.cloudflare.com/workers/ci-cd/builds/build-branches/#existing-workers-connected-to-builds).
Optionally, you can also [protect these Preview URLs with Cloudflare Access](https://developers.cloudflare.com/workers/previews/#access-control).
Note
Previews support different runtime settings for preview builds and production builds. Use [Preview settings](https://developers.cloudflare.com/workers/previews/configuration/) or the `previews` block in your Wrangler configuration to point preview builds at test bindings, variables, secrets, and resources.
For new Workers created with Workers Builds, preview builds use `wrangler preview` by default. Existing projects may need to update their [Preview command](https://developers.cloudflare.com/workers/ci-cd/builds/configuration/#preview-command) to `npx wrangler preview`.
### Headers and redirects
[`_headers`](https://developers.cloudflare.com/workers/static-assets/headers/) and [`_redirects`](https://developers.cloudflare.com/workers/static-assets/redirects/) files are supported natively in Workers with static assets. Ensure that, just like for Pages, these files are included in the static asset directory of your project.
### pages.dev
Where previously you were offered a `pages.dev` subdomain for your Pages project, you can now configure a personalized `workers.dev` subdomain for all of your Worker projects. You can [configure this subdomain in the Cloudflare dashboard](https://developers.cloudflare.com/workers/configuration/routing/workers-dev/#configure-workersdev), and opt-in to using it with the [`workers_dev` option](https://developers.cloudflare.com/workers/configuration/routing/workers-dev/#disabling-workersdev-in-the-wrangler-configuration-file) in your configuration file.
```jsonc
{
"name": "my-worker",
// Set this to today's date
"compatibility_date": "2026-10-27",
"main": "./worker/index.ts",
"upload_source_maps": true,
"workers_dev": true
}
name = "my-worker"
# Set this to today's date
compatibility_date = "2026-10-27"
main = "./worker/index.ts"
upload_source_maps = true
workers_dev = true
Custom domains
If your domain's nameservers are managed by Cloudflare, you can, like Pages, configure a custom domain for your Worker. Additionally, you can also configure a route if you only wish to some subset of paths to be served by your Worker.
Note
Unlike Pages, Workers does not support any domain whose nameservers are not managed by Cloudflare.
Rollout
Once you have validated the behavior of Worker, and are satisfied with the development workflows, and have migrated all of your production traffic, you can delete your Pages project in the Cloudflare dashboard or with Wrangler:
npmyarnpnpm
npx wrangler pages project delete
yarn wrangler pages project delete
pnpm wrangler pages project delete
Migrate your project using an AI coding assistant
You can add the following experimental prompt ↗︎ in your preferred coding assistant (e.g. Claude Code, Cursor) to make your project compatible with Workers:
https://developers.cloudflare.com/workers/prompts/pages-to-workers.txt
You can also use the Cloudflare Documentation MCP server ↗︎ in your coding assistant to provide better context to your LLM when building with Workers, which includes this prompt when you ask to migrate from Pages to Workers.
Compatibility matrix
This compatibility matrix compares the features of Workers and Pages. Unless otherwise stated below, what works in Pages works in Workers, and what works in Workers works in Pages. Think something is missing from this list? Open a pull request ↗︎ or create a GitHub issue ↗︎.
Legend
✅: Supported
⏳: Coming soon
🟡: Unsupported, workaround available
❌: Unsupported
Footnotes
- Workers can use Early Hints when the zone setting is turned on. Your Worker must send the appropriate
Linkheaders. For more information, refer to the 103 Early Hints example. ↩ - Middleware can be configured via the
run_worker_firstoption, but is charged as a normal Worker invocation. We plan to explore additional related options in the future. ↩ - To use Durable Objects with your Cloudflare Pages project, you must create a separate Worker with a Durable Object and then declare a binding to it in both your Production and Preview environments. Using Durable Objects with Workers is simpler and recommended. ↩
- Workers Builds supports enabling preview builds, though does not yet have the same level of configurability as Pages does. ↩
- Use custom domain Preview URLs to serve branch Previews on your own domain. Unlike Pages, where you can point any hostname at a branch, Workers serves each Preview at
<preview-name>.<your-domain>, and the Preview name defaults to the branch name. Cloudflare creates a wildcard DNS record and certificate for the domain you choose. ↩ - Workers supports popular frameworks, many of which implement file-based routing. Additionally, you can use Wrangler to compile your folder of
functions/into a Worker to help ease the migration from Pages to Workers. ↩ - As in <sup>6</sup>, Wrangler can compile your Pages Functions into a Worker. Or if you are starting from scratch, everything that is possible with Pages Functions can also be achieved by adding code to your Worker or by using framework-specific plugins for relevant third party tools. ↩
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/workers/static-assets/migration-guides/migrate-from-pages/#page","headline":"Migrate from Pages to Workers","description":"A guide for migrating from Cloudflare Pages to Cloudflare Workers. Includes a compatibility matrix for comparing the features of Cloudflare Workers and Pages.","url":"https://developers.cloudflare.com/workers/static-assets/migration-guides/migrate-from-pages/","inLanguage":"en","image":"https://developers.cloudflare.com/workers/static-assets/migration-guides/migrate-from-pages/og.png?v=edab3eb43a5d9092","dateModified":"2026-10-12","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Overview of entire document – what's in the docs, why Privacy Pass matters, high-level use case descriptions, and why customers can trust Cloudflare to run Privacy Pass infrastructure. title: Privacy Pass image: https://developers.cloudflare.com/privacy-pass/og.png?v=f0d3547dd70434d4
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/privacy-pass/llms.txt
Use this file to discover all available pages before exploring further.
Docs