Vercel 404 on redirection#4
Merged
Merged
Conversation
Without this, any direct navigation to a deep route (e.g. /activity, /authors, /app/settings) returns a 404 because Vercel serves the static dist/ output and has no file at those paths. The rewrite rule sends all non-API paths to index.html so React Router can handle routing on the client side.
src/api/client.ts - API base is now VITE_API_URL + '/api' when the env var is set, falling back to '/api' (Vite dev proxy) when it is not. This means local dev is unchanged; Vercel builds point straight at the Railway backend. server/index.ts - Add gitstats.hivarsoft.com and *.vercel.app to the CORS allowlist so the deployed frontend can reach the Railway API. vercel.json - Remove the broken /api rewrite that pointed back at Vercel itself. - Keep only the SPA catch-all so React Router handles all deep links. .env.example - Document VITE_API_URL for anyone setting up the project.
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.
fix 404 error on oauth app