Fix production 404: remove custom catch-all rewrite in vercel.json - #4
Merged
Conversation
Every non-excluded path (/, /ask, /api/*, etc.) has been 404ing in production. Runtime logs show the WSGI/ASGI app receiving the literal path "/api/index" for every one of these requests, instead of the actual requested path -- so neither FastAPI's nor Flask's router ever matches, and everything 404s. Paths excluded from the rewrite's negative-lookahead (static/, favicon.ico, manifest.webmanifest, service-worker.js) are unaffected and correctly reach api/index.py with their real path intact via Vercel's implicit default routing to the sole configured function -- proving the rewrite itself, not the app code, is what's collapsing the path to its literal destination string. Removing the custom rewrite lets that already-working implicit routing handle every path, matching the exact behavior already proven correct for the excluded paths above.
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
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
static/,favicon.ico,manifest.webmanifest, andservice-worker.js(the paths excluded from the custom rewrite)./api/indexfor every rewritten request instead of the real requested path, so neither FastAPI's nor Flask's router ever matches.api/index.pycorrectly via Vercel's implicit default routing (path preserved) — proving the customrewritesrule itself was the cause, not app code.Verification
GET /returned200with the actual rendered app HTML, and the deployment's own runtime log shows"GET / HTTP/1.1" 200 -"(previously"GET /api/index HTTP/1.1" 404 -"for the same path on production).Test plan
GET /on preview returns 200 with real app HTML (verified via runtime logs and an authenticated fetch)GET /,/ask,/api/daily-studyreturn 200 (not 404) and static asset routes are unaffected🤖 Generated with Claude Code