Skip to content
PidebugWeb

Diagnose CORS issue in Vite admin panel

Session from pi-traces on Hugging Face by Becks723 · MIT · condensed by Coders Talk

1msession
0interventions
GOAL

Investigate why the admin panel's API requests were being blocked by CORS during local development.

  1. Prompt · +0
    管理面板接口跨域,帮我看下是什么情况?
  2. Agent did · +0m
    Read vite.config.ts and src/api/axios.ts to check proxy and baseURL configuration
  3. Agent did · +0m
    Found 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
  4. Agent did · +0m
    Checked sdk.gen.ts to confirm generated request URLs are relative paths like /api/v1/... to determine what the proxy should match
  5. Outcome · +1m
    Root 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.

I tried this · 0

Discussion · 0

How Builds work