Skip to content

Add Vercel rewrites for API proxy and SPA fallback#6

Merged
kevincodex1 merged 1 commit into
mainfrom
fix/vercel-rewrites
Jul 3, 2026
Merged

Add Vercel rewrites for API proxy and SPA fallback#6
kevincodex1 merged 1 commit into
mainfrom
fix/vercel-rewrites

Conversation

@kevincodex1

Copy link
Copy Markdown
Contributor

Description

Production deploys on Vercel 404'd every API call ("failed to load repositories:
Failed to fetch repos: 404"). The app fetches /api/v1/repos same-origin, but the
proxy that forwards /api and /node-info to node.gitlawb.com lives in Vite's
dev server only — the deployed static build had nothing behind those paths.

vercel.json now mirrors the dev proxy in production:

  • /api/*https://node.gitlawb.com/api/*
  • /node-infohttps://node.gitlawb.com/ (node identity lives at the node's root)
  • catch-all → /index.html (SPA fallback so client-side routes like
    /repos/:owner/:name survive refresh and deep links — static assets are
    unaffected since Vercel serves filesystem matches before rewrites)

Also adds .vercel/ (the CLI's project-link directory) to .gitignore.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that changes existing behavior)
  • Refactor / code quality (no behavior change)
  • Documentation
  • Tests / CI

How was this tested?

  • Preview deploy with this config: repo list, node info, and deep links verified
    working in the browser (preview URLs are SSO-protected, so verification was
    interactive rather than curl).
  • Promoted to production (vercel --prod), deployment READY and aliased to
    explorer.gitlawb.com.
  • npm run lint / npm test (72) / npm run build all pass — config-only
    change, no source touched.

Checklist

  • npm run lint passes
  • npm test passes
  • npm run build passes (includes typecheck)
  • New logic in src/lib/ has colocated unit tests
  • I kept the change focused on a single concern

The Vite dev proxy (/api, /node-info → node.gitlawb.com) only exists in
the dev server, so the deployed static build 404'd every API call.
vercel.json now mirrors the proxy in production and adds an SPA fallback
so client-side routes survive refresh/deep links. Also ignores the
.vercel project-link directory.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@kevincodex1 kevincodex1 merged commit 0253e5c into main Jul 3, 2026
4 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.

1 participant