← All posts

Deploy a Static Site to Cloudflare Workers Static Assets with Wrangler

December 3, 2026 · 1 min read

CloudflareAstroWranglerDeployment

Cloudflare Workers Static Assets lets you host a static site on Cloudflare’s edge without a separate Pages project or a server. Your build output (dist/) is uploaded and served globally.

1. Configure Wrangler

Create wrangler.jsonc in your project root:

{
  "$schema": "node_modules/wrangler/config-schema.json",
  "name": "tech-portal",
  "compatibility_date": "2026-01-01",
  "assets": {
    "directory": "./dist",
    "not_found_handling": "404-page"
  }
}

The 404-page option serves your 404.html for unknown paths — essential for a static site with clean URLs.

2. Build your site

Astro in pure static mode produces a plain dist/ folder:

npm run build
ls dist   # index.html, blog/, exams/, 404.html

Keep the build light: no heavy UI framework, and cap the Node heap if your environment is small:

NODE_OPTIONS="--max-old-space-size=384" npm run build

3. Authenticate and deploy

Authenticate once — never put a token in a file or in git:

npx wrangler login        # interactive, or set CLOUDFLARE_API_TOKEN
npx wrangler whoami       # verify who you are
npx wrangler deploy       # uploads ./dist

4. Verify

After deploy, Wrangler prints your *.workers.dev URL. Check the home page, a blog post, and your 404.html by visiting a bogus path. Every deploy is atomic: visitors never see a half-uploaded site.

That’s it — static files, global edge, zero servers to patch.