Free

Cloudflare Pages and Workers: host a website and API

Choose Cloudflare Pages or Workers for your site and server code. Prepare the build, check a first release and keep an update and rollback procedure.

Tools

Open the service · Set up Workers · Upload built pages to Pages

Cloudflare Pages and Workers host a website and its server-side features online. Use them for built pages, web applications or a small API. Codex can prepare the project, check its build and carry out an approved release through your account.

Tool features

Pages publishes prebuilt pages and supports server functions. Workers can serve site files and execute server code together. Choose based on authentication, data storage, form handling and the existing application, not merely the presence of HTML.

For a new project with assets and server code, review Workers Static Assets. Do not migrate a working Pages project just to adopt a different product name.

How to choose a route and use Codex

This is a cloud service, not a plugin that automatically adds hosting to Codex. The assistant uses the existing project, Cloudflare dashboard or the official Wrangler CLI. Sign-in and new permissions require separate approval.

The official start for a new, separate learning Worker is:

npm create cloudflare@latest -- my-first-worker

First check Node.js and that the folder name is available. Choose a template for the required files and server features. Answer No to deployment until it has been checked. For an existing application, this command does not replace configuring its current project.

In the new folder, npx wrangler dev starts a local preview. Use the project's Wrangler and configuration rather than an arbitrary global copy. Authorise wrangler login only for your own account after reviewing its requested permissions. Do not place secrets in chat or the repository.

For Pages, choose Git integration or Direct Upload upfront: a Direct Upload project cannot later switch to Git integration. Wrangler uploads a build directory, not a ZIP. Dashboard archive upload is a Pages-specific route, not a way to update every Worker with server modules.

For Next.js, use the current Workers guide. It currently recommends vinext, noting its beta status and compatibility checks. If an application already uses OpenNext or another adapter, examine that route and its dependencies before changing it.

How to check a first release

  1. Have the assistant inspect the build directory, server routes, forms, secrets and connected resources. Agree on Pages or Workers and a separate test project or supported preview environment.
  2. Check pages, nested URLs, images, 404 handling and the main user action locally. Then separately approve a test deployment. Review the account, project name and affected resources before deploy.
  3. Open the returned cloud URL and repeat the checks on desktop and mobile. For a server application, verify actual API responses and role-based access, not just the homepage. Connect the domain separately afterwards.

A landing-page form needs confirmed delivery, not merely a “Sent” message. Hosting the files does not turn a local mock handler into a functioning server endpoint.

Where it fits in guides

Start with Where to host a landing page for free or with a paid plan, then publish and connect the domain. Choose the route for the task before purchasing hosting.

For accounts and server logic, use the web application deployment stage. Preserve existing server modules, resources and access settings when updating a live site.

The result is a working test version at a cloud URL, with its pages and required actions checked. A public domain, payments and database migration need separate checks and approval.

How to update and undo changes

Keep the source in Git and record the version you checked. Update through the existing project and release route. Do not upload HTML alone over an application that needs server code, secrets or storage bindings.

Before rolling back, inspect data changes: reverting code does not automatically restore a database. Before deleting a test project, check domains, scheduled jobs and separately created storage, then show the removal plan. Do not delete production resources because their names look similar.

Check the relevant product's pricing and limits: Workers and Pages. Static files, server calls and storage can be billed differently. Review the chosen setup before enabling paid resources.

Prompt for hosting a project

Paste this into Codex or Work with project access. The assistant first examines the existing setup; you approve a specific deployment after reviewing it.

Find the current project, its rules, build and hosting configuration. Prepare it for Cloudflare Pages or Workers. Identify static pages and the server routes, forms, accounts and storage it needs. Use current official Cloudflare guidance for my stack and preserve a working setup if suitable. Do not create a second project or replace an adapter without a reason.
Show the route, required connections, limits and possible costs. Check the installed Wrangler or available dashboard. Wait for approval before installation, authorisation, new permissions or cloud resource creation. Find paths yourself and do not reveal secrets.
Build locally and check nested pages, images, 404 handling, the main action, mobile and server responses. Then show a test deployment plan with the account, project and affected resources. Deploy only after my separate request and repeat the checks at the cloud URL. Record the version and rollback route; do not change domains or payments without agreement.
In This Article
Saved