Add Vercel SPA routing config to fix 404 on direct navigation#557
Merged
Add Vercel SPA routing config to fix 404 on direct navigation#557
Conversation
Vercel returns 404 when navigating directly to routes like /run/:slug because it looks for a matching file on disk. This rewrite rule tells Vercel to serve index.html for all routes, letting React Router handle client-side routing. Equivalent to the existing Netlify _redirects file. Co-Authored-By: Claude Opus 4.6 <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.
Summary
Direct navigation to routes like
/run/accuracycoinreturned 404 on Vercel because the deployment platform looked for matching files on disk instead of serving the SPA index.html. This adds a Vercel configuration file with a rewrite rule that matches the existing Netlify_redirectssetup, enabling React Router to handle all routes client-side.Test plan
/run/accuracycoin🤖 Generated with Claude Code