Cloudflare Workers
This docs site is deployed to Cloudflare Workers via Wrangler — the same setup works for any Red Glare project. A Red Glare build is a static site, so the Workers deployment is a thin Worker that serves the dist/ directory as static assets.
wrangler.jsonc
Create wrangler.jsonc at the project root:
{
"$schema": "https://unpkg.com/wrangler/config-schema.json",
"name": "my-agency-docs",
"compatibility_date": "2026-04-17",
"assets": {
"directory": "./dist",
"not_found_handling": "404-page"
}
}What each field does
name— the Worker name. Becomes part of the default URL (<name>.<subdomain>.workers.dev) unless you bind a custom domain.compatibility_date— pins the Workers runtime version for reproducibility. Use the date you first created the worker; update it when you adopt new runtime features.assets.directory— where the built site lives. Astro writes to./distby default.assets.not_found_handling—"404-page"tells Cloudflare to servedist/404.htmlfor unmatched routes. Red Glare generates a 404 page automatically, so this Just Works.
Build and deploy
pnpm build
pnpm dlx wrangler deploynpm run build
npx wrangler deployyarn build
yarn dlx wrangler deployThe first time you run wrangler deploy, you'll be prompted to authenticate — the CLI opens a browser to log in via OAuth. Afterwards the session is stored locally.
On subsequent deploys, wrangler deploy uploads dist/ and the worker goes live in under a minute.
CI/CD
For automatic deploys on push, use cloudflare/wrangler-action in GitHub Actions:
name: Deploy docs
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm build
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
workingDirectory: .Set CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID as repository secrets.
Scope the API token
Custom domains
Bind a custom domain to the Worker via Cloudflare dashboard or wrangler:
wrangler domains add docs.example.govThe domain must be on a zone in your Cloudflare account. Wrangler provisions the certificate automatically.
What's not deployed via this route
This setup is for static Red Glare sites — the common case. If you're running Astro in SSR mode with Cloudflare's adapter, that's a different setup: wrangler serves a Worker that runs your Astro server on each request, and the config looks different. Red Glare's doc/api/splash templates are all static — you only need SSR for dynamic content (user login, personalization, etc.) that this integration doesn't target.
Verifying the deploy
After wrangler deploy completes, it prints the live URL. Visit it and verify:
- The home page renders.
- The sidebar appears on a doc template page.
/feed.xmlreturns valid XML./llms.txtreturns text./sitemap-index.xmlreturns XML.- A made-up URL like
/nopereturns the 404 page (not a plain Cloudflare error).