Deploy the Astro template
Run npm ci, npm run check, and npm run build in the same Node version you tested. Publish the contents of dist/ to a host that serves directory indexes and returns your 404.html with status 404. Replace the prior output when deploying.
The template includes a Cloudflare Workers static assets recipe. Rename the Worker in the sample Wrangler configuration and use your existing Cloudflare deployment process. Cloudflare custom 404 routing.