11# Cloudflare Workers static-assets deployment for the static.polygon.technology
2- # HTTP endpoint. No worker script — Cloudflare serves the assembled dist/ bundle
3- # (network/ JSON tree + health-check index.html + _headers) directly from its
4- # edge. Replaces the previous nginx-on-ECS origin; the npm package
5- # (@polygonlabs/meta, packages/meta/) is a separate surface and unaffected.
2+ # HTTP endpoint. Cloudflare serves the assembled dist/ bundle (network/ JSON
3+ # tree + health-check index.html + _headers) directly from its edge; the tiny
4+ # worker script exists only because the asset layer serves GET/HEAD and 405s
5+ # every other method — including the OPTIONS preflights browsers send for
6+ # maticjs's Content-Type-bearing GETs (see worker/worker.ts). Replaces the
7+ # previous nginx-on-ECS origin; the npm package (@polygonlabs/meta,
8+ # packages/meta/) is a separate surface and unaffected.
69name = " polygon-static"
10+ main = " worker/worker.ts"
711compatibility_date = " 2026-06-24"
812placement = { mode = " smart" }
913workers_dev = false
@@ -15,6 +19,14 @@ directory = "./dist"
1519# Missing paths return a real 404 (a JSON CDN, not an SPA). The old nginx
1620# try_files fell back to index.html, masking 404s as 200+HTML.
1721not_found_handling = " none"
22+ # Lets the worker delegate non-OPTIONS requests back to the asset layer.
23+ binding = " ASSETS"
24+ # Required for the worker to see OPTIONS at all: without it the asset layer
25+ # answers non-GET/HEAD on asset-matched paths itself (405) — verified with
26+ # `wrangler dev`; the docs' "other methods route to the Worker" doesn't hold
27+ # for matched paths. GET/HEAD delegated via the binding still get _headers
28+ # and not_found_handling applied.
29+ run_worker_first = true
1830
1931[build ]
2032command = " pnpm run build:cdn"
0 commit comments