TickYouOff
Back
☁️

Deploying a Static Site with Cloudflare Pages

Easy 16 items · 30 min
testuser's avatar
testuser Published 1 month ago

This checklist guides you through deploying a static site on Cloudflare Pages, from connecting your Git repo to DNS and analytics. It’s for developers and site owners who want a quick, reliable deployment workflow.

Progress
0 / 16
  1. Connect GitHub repository to Cloudflare Pages — Authorize Pages to access the repo and select the project repository.
  2. Select production branch to deploy (e.g., main) — Choose the branch that will trigger production builds.
  3. Set build command and output directory (e.g., npm run build, public) — Enter the exact build command and folder that contains static assets.
  4. Add environment variables and secrets in Pages — Store API keys and build-time vars in the Pages dashboard, not in source control.
  5. Add production environment variables (secrets) — Use the production environment to store live API keys and database URLs.
  6. Add preview branch environment variables — Provide safe or read-only keys for preview builds to avoid leaking production secrets.
  7. Enable preview deployments for branches and pull requests — Allow per-branch previews so team members can review changes before merging.
  8. Add redirects and headers files to your repo (e.g., _redirects, _headers, netlify.toml) — Include SPA redirects and security headers so routing and CSP work after deploy.
  9. Configure caching and edge TTLs using headers or Cloudflare settings — Set Cache-Control and Edge TTL to balance freshness and performance.
  10. Add custom domain in Pages dashboard — Register your domain in Pages and follow the verification prompts.
  11. Create DNS records for custom domain (CNAME for subdomain or A/AAAA for root) — Point your domain to the records Pages provides; use CNAME flattening if needed.
  12. Verify TLS / HTTPS and enable Always Use HTTPS — Wait for certificate issuance, then force HTTPS to secure all traffic.
  13. Set up redirects (www ↔ root) in DNS or Pages to canonicalize your domain — Choose a primary hostname and redirect the alternative to it for SEO.
  14. Enable Cloudflare Web Analytics for the site — Turn on privacy-friendly analytics in Pages to view simple traffic stats.
  15. Test production and preview deployments: check links, assets, and forms — Open URLs and verify assets load, forms submit, and third-party integrations work.
  16. Monitor deployment logs and set alerts for failed builds — Review build logs in Pages and enable notifications for build failures.
Sign in to save
📝 My Notes