Skip to content

fix(redirects): serve legacy redirects in production via render.yaml#72

Merged
pete-vielhaber merged 1 commit into
zerodevapp:mainfrom
a-thomas-22:at/lucid-hoover-a79b2b
Jun 26, 2026
Merged

fix(redirects): serve legacy redirects in production via render.yaml#72
pete-vielhaber merged 1 commit into
zerodevapp:mainfrom
a-thomas-22:at/lucid-hoover-a79b2b

Conversation

@a-thomas-22

Copy link
Copy Markdown
Contributor

Problem

Production deploys on Render (a manually-created static site), not Vercel. Render ignores vercel.json, so the 201 redirects wired up in #71 never took effect in prod — every legacy URL kept 404ing.

Pulling the live service config revealed a second, deeper issue: the service already had broad SPA-fallback rewrite rules (/sdk/*, /react/*, /smart-wallet/*, /meta-infra/*, /recovery-flow/*/index.html). Render applies the first matching rule by priority, top to bottom, so those wildcards sat above the redirects and swallowed ~145 of the 201 legacy URLs into the app shell (which then renders an in-app 404).

Fix

Adopt the existing Render static site with a Blueprint and order the routes correctly.

  • render.yaml — Render Blueprint that adopts the existing docs service (matched by name; service def / build / domains / env mirror the live config). The generated redirects are emitted above the SPA-fallback rewrites so they win under first-match routing.
  • redirects.config.js stays the single source of truth. Folds in /magic-account/smart-accounts/chain-abstraction/overview (the live rule pointed at /sdk/advanced/chain-abstraction, itself now legacy — collapsed the broken hop).
  • scripts/sync-render-redirects.mjs — splices the generated block between BEGIN/END sentinels, preserving the hand-maintained service def + SPA fallbacks. Output is prettier-clean by construction (block style + double-quoted scalars = prettier's default YAML), so no .prettierignore and npm run format leaves it alone.
  • .github/workflows/redirects-in-sync.yml + npm scripts now regenerate and diff render.yaml, failing the PR if it drifts from redirects.config.js.
  • Removed the unused vercel.json and its sync script.

Deploy steps (Render)

  1. Merge so render.yaml lands on main.
  2. Render Dashboard → New → Blueprint → connect zerodevapp/docs → pick the branch.
  3. On the change-preview, confirm it updates the existing docs service — not a new suffixed one (a suffix means the name didn't match). Existing sync: false env vars are preserved on adoption.
  4. Deploy Blueprint. render.yaml then becomes the source of truth and pushes auto-deploy.

Note

Render's redirect type is 301 (not configurable), so these are permanent/hard-cached — a behavior difference from the 307 the previous approach intended.

Verify after deploy

curl -sI https://docs.zerodev.app/sdk/getting-started/quickstart | grep -i 'http/\|location'
# -> HTTP/2 301 ... location: /get-started/quickstart

Production runs on Render (a manually-created static site), which ignores
vercel.json — so the redirects wired up in zerodevapp#71 never applied in prod. The live
service also had broad SPA-fallback rewrites (/sdk/*, /react/*, /smart-wallet/*,
/meta-infra/*, /recovery-flow/*) that, under Render's first-match-by-priority
routing, swallowed ~145 of the 201 legacy URLs into the app shell (-> in-app 404).

- render.yaml: Render Blueprint that adopts the existing "docs" static site.
  Generated redirects sit ABOVE the SPA-fallback rewrites so they take priority.
- redirects.config.js stays the single source of truth; folds in /magic-account
  (collapsing its stale /sdk/advanced/chain-abstraction hop).
- scripts/sync-render-redirects.mjs splices the generated block between
  sentinels, preserving the hand-maintained service def + fallbacks. Output is
  prettier-clean by construction.
- CI (redirects-in-sync) + npm scripts now target render.yaml.
- Remove the unused vercel.json and its sync script.
@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

@a-thomas-22 is attempting to deploy a commit to the zero-dev1 Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jun 26, 2026 4:28pm

Request Review

@pete-vielhaber pete-vielhaber left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pete-vielhaber pete-vielhaber merged commit c9748f0 into zerodevapp:main Jun 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants