Diagnose CORS issue in Vite admin panel
Session from pi-traces on Hugging Face by Becks723 · MIT · condensed by Coders Talk
Click a segment to jump to that moment
1msession
0interventions
by library · 2d
GOAL
Investigate why the admin panel's API requests were being blocked by CORS during local development.
- +0Prompt · +0管理面板接口跨域,帮我看下是什么情况?
- +0mAgent did · +0mRead vite.config.ts and src/api/axios.ts to check proxy and baseURL configuration
- +0mAgent did · +0mFound vite.config.ts has no server.proxy despite CLAUDE.md claiming it proxies /api and /internal; axios.ts uses an absolute baseURL instead. Searched codebase and generated API client for other baseURL references
- +0mAgent did · +0mChecked sdk.gen.ts to confirm generated request URLs are relative paths like /api/v1/... to determine what the proxy should match
- +1mOutcome · +1mRoot cause identified: missing Vite proxy config combined with an absolute baseURL in axios.ts causes requests to hit the remote domain directly, triggering CORS
VERDICT
Next time I'd ask it to check the docs against the actual config right away, since the CLAUDE.md description didn't match vite.config.ts at all. Having it grep for baseURL and proxy usage across the codebase was what actually pinned down the two separate misconfigurations. This session was pure diagnosis, no fix was applied yet.