Skip to content

Add vercel.json to fix SPA routing 404s on Vercel - #3

Merged
aayu5hgit merged 2 commits into
mainfrom
copilot/fix-repo-issues-for-deployment
Feb 27, 2026
Merged

aayu5hgit merged 2 commits into
mainfrom
copilot/fix-repo-issues-for-deployment

Conversation

Copilot AI commented Feb 27, 2026 •

Copy link
Copy Markdown
Contributor

Deploying this React Router (BrowserRouter) app to Vercel without routing config causes 404s on any direct URL access or page refresh outside of /, since Vercel tries to resolve routes as static files.

Changes

  • vercel.json — adds a catch-all rewrite to serve index.html for all routes, letting React Router handle client-side navigation:
{
  "rewrites": [
    { "source": "/(.*)", "destination": "/index.html" }
  ]
}

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@vercel

vercel Bot commented Feb 27, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
shiksha Error Error Feb 27, 2026 0:42am

Co-authored-by: aayu5hgit <86314754+aayu5hgit@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issues in the repo to enable Vercel deployment Add vercel.json to fix SPA routing 404s on Vercel Feb 27, 2026
@aayu5hgit
aayu5hgit marked this pull request as ready for review February 27, 2026 12:45
Copilot AI review requested due to automatic review settings February 27, 2026 12:45
@aayu5hgit
aayu5hgit merged commit ce3ba31 into main Feb 27, 2026
1 of 3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds Vercel deployment routing configuration so this React Router (BrowserRouter) SPA won’t return 404s on direct navigation/refresh of non-root routes, by rewriting all requests to index.html and letting the client router handle routing.

Changes:

  • Add vercel.json with a catch-all rewrite rule to index.html for SPA routing support on Vercel.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

This branch had an error being deployed

1 failed deployment
Preview — 19c38f94 Deployed Feb 27, 2026 by vercel[bot]
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.

3 participants