Skip to content

Deploying to Cloudflare Pages

Once your documentation is written, you need to publish it to the public internet so your team and users can access it. EpoCanvas Docs recommends hosting on Cloudflare Pages: no server to buy, no Nginx to configure — just upload the static files and you automatically get an HTTPS certificate. This site itself (docs.epocanvas.com) was published using the method in this guide, and all dashboard screenshots below come from a real deployment.


Prerequisites

What You Need

ItemDetails
A Cloudflare accountRegister for free at dash.cloudflare.com; Pages does not require a paid plan
A complete local buildRun pnpm run build first and confirm the dist/ directory is generated correctly, see Quickstart
Node.js + pnpmThe deploy commands depend on your local development environment; version requirements are the same as in the Quickstart chapter

Choosing Between the Two Deployment Methods

Comparison of the two Cloudflare Pages deployment paths: direct upload from the local command line on the left (used by this site), automatic builds from a Git repository on the right (recommended for team collaboration)

Figure: A comparison of the two Cloudflare Pages deployment paths. On the left, build locally and upload directly to the edge with Wrangler (what this site actually uses); on the right, a GitHub Webhook triggers an automatic cloud build.

ComparisonMethod 1: Command-Line Direct UploadMethod 2: Automatic Builds from Git
How it worksRun pnpm run deploy locallyPushing code to GitHub triggers the build automatically
DifficultyLow — two commandsMedium — one-time configuration in the dashboard
Best forFirst launch, single maintainer, quick updatesTeam collaboration, wanting “commit = live”
Used by this site✅ Yes (verifiable in the dashboard)Not enabled; can be added at any time

With this method, the site is built locally and uploaded directly to Cloudflare. It is what this site actually uses.

Step 1: Log In to Your Cloudflare Account

The project ships with Wrangler (Cloudflare’s official command-line tool). The first use requires browser authorization:

Terminal window
npx wrangler login

The terminal prints Opening a link in your default browser... and the browser opens the Cloudflare authorization page. After clicking Allow, the terminal confirms the login. Verify your login state with:

Terminal window
npx wrangler whoami

Step 2: One-Command Build and Upload

The project presets a one-command publish script in package.json:

Terminal window
pnpm run deploy

It runs two steps in sequence: first astro build compiles the whole site into the dist/ directory and generates the search index, then wrangler pages deploy dist uploads the output directly to Cloudflare. The real build output looks like this:

23:54:01 [build] 181 page(s) built in 20.78s
23:54:01 [build] Complete!

When the upload finishes, Wrangler prints a preview URL for this deployment. The project name is preset by the deploy script (--project-name epocanvas-docs), so nothing is asked interactively during deployment.

Step 3: Find Your Project in the Dashboard

Open dash.cloudflare.com and click Compute (Workers & Pages) in the left menu to see the project list. The image below marks three key spots:

Workers & Pages project list in the Cloudflare dashboard, marking the left menu entry, the Create application button, and the epocanvas-docs project

Figure: The Workers & Pages project list. ① Navigate to Workers & Pages in the left menu; ② the Create application button creates a new project; ③ our epocanvas-docs project, showing the domain epocanvas-docs.pages.dev and the most recent deployment time.

Click the project name to open the project details. The Deployments tab shows the full deployment history:

Deployment history page of the epocanvas-docs project, marking the production domains, deployment records, and statuses

Figure: The deployment history page. ① Project name; ② Deployments tab; ③ the production domain is bound to both docs.epocanvas.com (custom domain) and epocanvas-docs.pages.dev (default domain); ④ each deployment record shows its branch and commit message; ⑤ status and deployment time.


Understanding the Build Configuration of a Direct-Upload Project

Open the Settings tab to see how a direct-upload project differs from a Git-connected one:

Settings build configuration page of the epocanvas-docs project, with the Git repository section showing it is not connected

Figure: The Settings tab. ① Settings entry; ② the Git repository section shows Connect (not connected) — a direct-upload project needs no Git build configuration because the build happens entirely on your local machine.


Method 2: Connect a Git Repository for Automatic Builds (Optional)

If you want every push to go live automatically, you can connect the project to a GitHub repository and let Cloudflare build it in the cloud.

Step 1: Start the Creation Flow

On the Workers & Pages project list page, click the Create application button in the top-right corner (marked ② in the screenshot in Method 1, Step 3) and select the Pages tab.

Step 2: Connect a Git Repository

  1. Choose Connect to Git in the creation screen;
  2. Authorize Cloudflare to access your GitHub account;
  3. Select the documentation repository epocanvas-docs from the repository list;
  4. Click Begin setup.

Step 3: Fill In the Build Configuration

In “Set up builds and deployments”, enter the following:

SettingValue
Framework presetAstro
Build commandpnpm run build
Build output directorydist

Step 4: Verify the Automatic Build

Click Save and Deploy and Cloudflare completes the first build automatically. Afterwards, every push to the main branch makes Cloudflare pull, build, and publish automatically. The build log for each deployment can be viewed by clicking that deployment in the project’s Deployments tab.


Bind a Custom Domain

The default epocanvas-docs.pages.dev domain assigned by Cloudflare works out of the box; binding your own domain (for example docs.epocanvas.com) takes only a few minutes.

Step 1: Open the Custom Domain Settings

In the project details, click the Custom domains tab, then click Set up a custom domain:

Custom domains page of the epocanvas-docs project, with docs.epocanvas.com bound and SSL active

Figure: The Custom domains tab. ① Tab entry; ② the Set up a custom domain button; ③ the bound docs.epocanvas.com, with status Active and SSL enabled.

Step 2: Add the Domain and Wait for It to Take Effect

  1. Click Set up a custom domain and enter your subdomain (e.g. docs.epocanvas.com);
  2. If the domain’s DNS is already hosted on Cloudflare, the CNAME record is added automatically; for domains hosted elsewhere, add a CNAME record manually pointing to <project-name>.pages.dev;
  3. Wait for the certificate to be issued (usually 2–5 minutes). Once the status changes to Active (marked ③ in the image above), the site is reachable through the new domain.

HTTPS certificates are issued and renewed automatically by Cloudflare; no manual application or configuration is needed.


Verify the Deployment

Check the HTTP Status from the Command Line

Terminal window
curl -sI https://epocanvas-docs.pages.dev

The real response:

HTTP/2 200
date: Fri, 11 Sep 2026 15:32:39 GMT
content-type: text/html; charset=utf-8

A 200 means the site is healthy. After binding a custom domain, run the check again with your own domain in the URL.

Check Each Item in the Browser

CheckExpected result
Homepage and any document page openPage renders fully, no blank screen
Recent changes are liveThe section you just edited is visible online
Ctrl+K site-wide searchFinds the latest articles (the index is generated with the build)
Light/dark theme toggleSwitches correctly and persists after a refresh

Common Deployment Issues

Content Not Updated Online After Deployment?

Hard-refresh the browser (Ctrl+F5 / Cmd+Shift+R) to rule out caching. If it still does not update, check the timestamp of the latest record on the Deployments page in the dashboard, then compare against the deployment preview domain with curl -sI.

Custom Domain Shows an SSL Handshake Failure (Error 525)?

Certificate issuance takes 2–5 minutes to propagate globally; wait and hard-refresh. In the meantime you can use the default epocanvas-docs.pages.dev domain.

pnpm run deploy Fails with Project not found?

First run npx wrangler whoami to confirm you are logged in; then check that the --project-name in the deploy script of package.json matches the project name in the dashboard.

For more troubleshooting, see FAQ & Troubleshooting.