You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Request]: Let a project configure the 404 response for unmatched routes #309
Problem: A request that matches no route always gets the built-in plain-text response, and nothing in the schema or docs lets a project change it.
Reproduced on current source: a project with one route /, then curl -i localhost:PORT/nope returns 404, content-type: text/plain; charset=utf-8, body Not found.
Any site with pages needs a branded or on-topic 404. Today the workaround is a catch-all route /{path} with a function or page, which costs a route, a sandbox decision and loses the accurate unmatched-route behavior. The blog agent listed this under "Not found / gaps" and wrote an HTML 404 inside a function.
(I found no existing issue: searched open and closed for 404 / not found / error page.)
Proposed behavior: A top-level key (for example site.notFound: {page: file:...} or notFound: {status: 404, page: ...}) that serves a static page with status 404 for unmatched routes.
Acceptance:
The page is served with status 404 and content-type: text/html, and works with urlcode build --target static (as 404.html) and --target cloudflare.
urlcode schema documents the key.
A recipe or fixture in tests/requests.json asserts the status and body.
If the answer is "use a catch-all route", document that pattern instead and close this.
Evidence:benchmarks/results/blog-ab-2026-09-20/agent-b-urlcode/REPORT.md ("Not found / gaps").
Shipped in #316: site.notFound: serves that page with status 404 for unmatched GET/HEAD on self-hosted, Vercel and AWS, and build --target static writes 404.html. build --target cloudflare refuses it explicitly (no asset binding), so the issue's Cloudflare acceptance item is not met; keeping this open until an asset-binding decision is made. Other methods keep the plain-text Not found.
Fixed in #384: site.notFound is now inlined into the Worker bundle for the Cloudflare target (bounded to 64 KiB, valid UTF-8), so GET/HEAD on an unmatched route answers with the configured page and status 404, HEAD is empty with the right content-length, POST keeps the plain-text Not found, and a direct GET /404.html still returns 200. Verified on real workerd (wrangler dev --local, nothing deployed). A Workers Static Assets binding for serving more than one small file is deferred and recorded in docs/OPEN-DECISIONS.md. Core package entry count: 430 of 440, unchanged.
Activity
jimhoyd commentedon Sep 20, 2026
Progress: an agent has started on this; a PR will be linked here when it opens.
feat: site.notFound serves a configured page with status 404 (refs #309)
feat: site.notFound serves a configured page with status 404 (refs #309…
jimhoyd commentedon Sep 20, 2026
Shipped in #316: site.notFound: serves that page with status 404 for unmatched GET/HEAD on self-hosted, Vercel and AWS, and build --target static writes 404.html. build --target cloudflare refuses it explicitly (no asset binding), so the issue's Cloudflare acceptance item is not met; keeping this open until an asset-binding decision is made. Other methods keep the plain-text Not found.
Add request.body.schema and parameter format/pattern (refs #254) (#306)
jimhoyd commentedon Sep 21, 2026
Progress: an agent has started on this; a PR (or a recommendation comment) will be linked here.
feat: inline site.notFound on the Cloudflare Worker (refs #309) (#384)
jimhoyd commentedon Sep 21, 2026
Fixed in #384: site.notFound is now inlined into the Worker bundle for the Cloudflare target (bounded to 64 KiB, valid UTF-8), so GET/HEAD on an unmatched route answers with the configured page and status 404, HEAD is empty with the right content-length, POST keeps the plain-text Not found, and a direct GET /404.html still returns 200. Verified on real workerd (wrangler dev --local, nothing deployed). A Workers Static Assets binding for serving more than one small file is deferred and recorded in docs/OPEN-DECISIONS.md. Core package entry count: 430 of 440, unchanged.