diff --git a/apps/admin/vite.config.ts b/apps/admin/vite.config.ts index e68c271..7811c04 100755 --- a/apps/admin/vite.config.ts +++ b/apps/admin/vite.config.ts @@ -25,6 +25,14 @@ export default defineConfig({ host: true, port: 3001, allowedHosts: ['manage.sauci.app'], + // The API has no CORS handling, so local development serves API calls + // same-origin and forwards them to the local API process. + proxy: { + '/v1': { + target: process.env.SAUCI_ADMIN_API_PROXY ?? 'http://127.0.0.1:3003', + changeOrigin: true, + }, + }, watch: { usePolling: true, interval: 100, diff --git a/scripts/dev-local.sh b/scripts/dev-local.sh index e99a629..a9b8926 100755 --- a/scripts/dev-local.sh +++ b/scripts/dev-local.sh @@ -110,7 +110,7 @@ SERVERS=( "api|PORT=$API_PORT DATABASE_URL=$LOCAL_DATABASE_URL MEDIA_ROOT=$ROOT/.local/media MEDIA_SIGNING_SECRET=local-media-signing-secret-change-me-123456 MEDIA_PUBLIC_BASE_URL=http://127.0.0.1:$API_PORT npm run dev -w @sauci/api" "worker|DATABASE_URL=$LOCAL_DATABASE_URL CLASSIFIER_ENABLED=false MEDIA_ROOT=$ROOT/.local/media MEDIA_SIGNING_SECRET=local-media-signing-secret-change-me-123456 MEDIA_PUBLIC_BASE_URL=http://127.0.0.1:$API_PORT npm run dev:worker -w @sauci/api" "web|env NEXT_PUBLIC_API_URL=$LOCAL_API_URL npm run dev -w @sauci/web -- --port $WEB_PORT" - "admin|env VITE_API_URL=$LOCAL_API_URL npm run dev -w @sauci/admin -- --host 127.0.0.1 --port $ADMIN_PORT" + "admin|env VITE_API_URL=/ SAUCI_ADMIN_API_PROXY=$LOCAL_API_URL npm run dev -w @sauci/admin -- --host 127.0.0.1 --port $ADMIN_PORT" "mcp|env PORT=$MCP_PORT npm run dev -w sauci-mcp-server" "mobile|npm run dev -w @sauci/mobile -- --port $METRO_PORT --localhost" )