Repository navigation
ci(website): Serve each build's own 404 page - #4442
Conversation
Vercel answers every miss with the root's 404.html, so a missing page under /next/ or a locale showed the root site's 404, and on an archive host it loaded no styles. docs deploy now adds an error-phase route per 404.html in the build, so each archive host, /next/ and locale serves its own. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YJ3T6rbteN6Ra4Kg1m8P1s
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Staff engineer (Cursor agent): LGTM. One idea for after this lands; nothing needs to change in this PR. What I checked: I ran the new Direction: Changing FOLLOW_UP (after merge, only if it comes up again): |
|
Docs preview: https://docs-site-pr-4442-data-client.vercel.app Built from 2ca231c merged into |
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YJ3T6rbteN6Ra4Kg1m8P1s
…rite Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YJ3T6rbteN6Ra4Kg1m8P1s
Requested by Nathaniel · project thread
Follow-up to #4415.
Motivation
Vercel answers every miss with the deployment root's one
404.html. So a bookmark, search result or external link to a missing page:/next/shows the root (0.18) site's 404 app, labelled with the root's version;/es/...) shows the English 404;<v>.dataclient.io) gets the root's404.html, whose/assets/...the host rewrite maps toarchives/<v>/assets/..., which don't exist: no CSS or JS.vercel build's output confirms it: the error phase has a single route,{ "src": "^(?!/api).*$", "dest": "/404", "status": 404 }.Solution
docs deployalready edits.vercel/output/config.json(to move the archive host rewrite). It now also lists every404.htmlin the deployed build (find website/build -mindepth 2 -name 404.html) and adds one error-phase route per build ahead of the root's catch-all, so it adapts to whatever was built (English-only previews,/next/or not, archives with or without locales):{ "src": "^(?:/archives/0\\.17)?/es/", "has": [{ "type": "host", "value": "0\\.17\\.dataclient\\.io" }], "dest": "/archives/0.17/es/404", "status": 404 }, { "src": "^(?:/archives/0\\.17)?/(?!api)", "has": [{ "type": "host", "value": "0\\.17\\.dataclient\\.io" }], "dest": "/archives/0.17/404", "status": 404 }, { "src": "^/next/es/", "dest": "/next/es/404", "status": 404 }, { "src": "^/next/", "dest": "/next/404", "status": 404 }, { "src": "^/es/", "dest": "/es/404", "status": 404 }, { "src": "^(?!/api).*$", "dest": "/404", "status": 404 }Archive routes go first (their hosts' paths look like the root's), then the longest prefix wins. Archive
srcaccepts both the host's own path and the rewritten/archives/<v>/...one, since the miss may reach the error phase after the host rewrite. The step fails if the config has no error phase.Checked by running
vercel build(CLI 63.1.2, the pinned version) on a mock build with/es,/next,/next/esand an archive, then the new step: routes above; with an English-only build only the root route remains. Not checked on a live deploy: previews have no/next/or archives, and dataclient.io isn't reachable from my environment, so the first production deploy is where/next/<missing>and/es/<missing>show it.Docs:
.cursor/rules/ci-config.mdc(and generated.claude/rules),website/scripts/snapshot/README.md.Generated by Claude Code
Note
Medium Risk
Changes production Vercel routing for all 404 responses across root, locales, /next/, and archive hosts; mis-generated routes could break error pages until the next deploy.
Overview
Fixes broken or wrong-version 404 pages when Vercel falls through to the deployment root’s single
404.html(e.g. unstyled archive hosts,/next/showing the current site’s 404, locales showing English).The
docs deployjob insite-preview.ymlnow patches.vercel/output/config.jsonaftervercel build: it discovers every built404.html(root, locales,/next/, archives) and inserts error-phase routes ahead of the root catch-all—archive hosts first withhas: host, then longest path prefix—so each slice serves its own styled 404. The step errors if the config has no error phase.CI/agent docs (
ci-config.mdc/ generated.claude/rules) andwebsite/scripts/snapshot/README.mddocument this alongside the existing archive rewrite reordering.Reviewed by Cursor Bugbot for commit 2ca231c. Bugbot is set up for automated code reviews on this repo. Configure here.