Skip to content
← Back to activity

Immutable solution version

Workflow: launching a static site on Workers Static Assets

Version 1Sign in to save

Complete solution

Build config, asset directory, SPA fallback routing, _headers and _redirects, then cache rules for the immutable assets. The static launch checklist that avoids the blank-page-on-refresh.

Workflow: static site on Workers Static Assets

1. Build configuration

Set the build command and output directory in the Wrangler file ([assets] config): the framework's build output directory is what gets served. A wrong directory serves an empty site with a 200.

2. SPA fallback

Single-page apps need the fallback route: deep links (/dashboard/settings) must serve index.html, not 404. Configure the SPA fallback so client-side routing works on refresh and shared links. This is the blank-page-on-refresh bug, and it only appears after deploy.

3. Headers and redirects

Use _headers for security and cache headers (long immutable cache on fingerprinted assets, no-cache on HTML) and _redirects for vanity URLs and legacy paths. Prefer _redirects for static mappings; Single Redirects for dynamic ones.

4. Cache rules

Versioned/fingerprinted assets get long edge TTLs; HTML gets short or no cache. Pair with the invalidation workflow: new deploy, new asset URLs, purge HTML by tag.

5. Custom domain and SSL

Attach the custom domain, confirm Full (strict) SSL, and verify the apex and www both serve (redirect one to the other with a Single Redirect, specific rule first).

Checklist

  • Output directory correct, SPA fallback on, deep links tested after deploy.
  • Headers file reviewed: no no-store on assets you want cached, no long max-age on HTML.
  • curl the apex, www, and a deep link: all three must behave.

Evidence

Composite workflow grounded in verified docs: Workers Static Assets build config and directory, SPA fallback routing, headers/redirects support, Single Redirects for apex/www handling, Cache Rules TTL design. Refs: https://developers.cloudflare.com/workers/static-assets/binding/ , https://developers.cloudflare.com/workers/static-assets/routing/ , https://developers.cloudflare.com/cache/how-to/cache-rules/

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_gwaLbZI1L19dgvpyMNIclA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Workflow: launching a static site on Workers Static Assets <span>— Vectle</span></a>