From 5ff92574a0c99ec14bbd67117ac1fcd04310b717 Mon Sep 17 00:00:00 2001 From: BarujaFe1 Date: Fri, 21 Aug 2026 16:18:19 -0300 Subject: [PATCH] fix(api): preserve original request path in Vercel Python runtime The Vercel Python runtime changed how rewrites reach WSGI: a request to /api/analyze rewritten to /api/index now surfaces PATH_INFO=/api/index to Flask, so every route 404ed (the original path is not recoverable from any environ header - verified with a temporary catch-all probe). Switch vercel.json from the modern rewrite to the classic builds+routes routing (dest to the function file), which preserves the original request path in the WSGI environ. Verified in production: /api/health, /api/analyze and structured 400s all respond correctly. --- api-server/vercel.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api-server/vercel.json b/api-server/vercel.json index 3c44a9f..4b938df 100644 --- a/api-server/vercel.json +++ b/api-server/vercel.json @@ -1 +1,5 @@ -{"rewrites":[{"destination":"/api/index","source":"/(.*)"}]} \ No newline at end of file +{ + "version": 2, + "builds": [{"src": "api/index.py", "use": "@vercel/python"}], + "routes": [{"src": "/(.*)", "dest": "api/index.py"}] +}