Add Vercel rewrites for API proxy and SPA fallback#6
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Production deploys on Vercel 404'd every API call ("failed to load repositories:
Failed to fetch repos: 404"). The app fetches
/api/v1/repossame-origin, but theproxy that forwards
/apiand/node-infotonode.gitlawb.comlives in Vite'sdev server only — the deployed static build had nothing behind those paths.
vercel.jsonnow mirrors the dev proxy in production:/api/*→https://node.gitlawb.com/api/*/node-info→https://node.gitlawb.com/(node identity lives at the node's root)/index.html(SPA fallback so client-side routes like/repos/:owner/:namesurvive refresh and deep links — static assets areunaffected since Vercel serves filesystem matches before rewrites)
Also adds
.vercel/(the CLI's project-link directory) to.gitignore.Type of change
How was this tested?
working in the browser (preview URLs are SSO-protected, so verification was
interactive rather than curl).
vercel --prod), deployment READY and aliased toexplorer.gitlawb.com.
npm run lint/npm test(72) /npm run buildall pass — config-onlychange, no source touched.
Checklist
npm run lintpassesnpm testpassesnpm run buildpasses (includes typecheck)src/lib/has colocated unit tests