From 4cd84a47349681c23110fc2ed7308794a6fa805c Mon Sep 17 00:00:00 2001 From: DhanushSantosh Date: Sun, 18 Jan 2026 01:37:49 +0530 Subject: [PATCH] fix: add API proxy to Vite dev server for web mode CORS When running in web mode (npm run dev:web), the frontend on localhost:3007 was making cross-origin requests to the backend on localhost:3008, causing CORS errors. Added Vite proxy configuration to forward /api requests from the dev server to the backend. This makes all API calls appear same-origin to the browser, eliminating CORS blocks during development. Now web mode users can access http://localhost:3007 without CORS errors. Fixes: CORS "Not allowed by CORS" errors in web mode Co-Authored-By: Claude Haiku 4.5 --- apps/ui/vite.config.mts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/ui/vite.config.mts b/apps/ui/vite.config.mts index 0d18997e..81d74391 100644 --- a/apps/ui/vite.config.mts +++ b/apps/ui/vite.config.mts @@ -68,6 +68,12 @@ export default defineConfig(({ command }) => { host: process.env.HOST || '0.0.0.0', port: parseInt(process.env.TEST_PORT || '3007', 10), allowedHosts: true, + proxy: { + '/api': { + target: 'http://localhost:3008', + changeOrigin: true, + }, + }, }, build: { outDir: 'dist',