From 655da23d142369ad17164b61ad297e6d6b3a2ca1 Mon Sep 17 00:00:00 2001 From: Till-JS <101404291+Till-JS@users.noreply.github.com> Date: Sat, 29 Nov 2025 06:58:00 +0100 Subject: [PATCH] fix(presi): resolve CORS issues and add strictPort to all web apps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add port 5180 to CORS_ORIGINS in .env.development - Add port 5178 to Presi backend CORS config - Fix Presi API client to use /api prefix - Add strictPort: true to all web app vite configs to prevent port switching: - manacore: 5173 - chat: 5174 - picture: 5175 - manadeck: 5176 - zitare: 5177 - presi: 5178 - voxel-lava: 5180 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .env.development | 2 +- apps/chat/apps/web/vite.config.ts | 4 ++++ apps/manacore/apps/web/vite.config.ts | 4 ++-- apps/manadeck/apps/web/vite.config.ts | 4 ++++ apps/picture/apps/web/vite.config.ts | 4 ++++ apps/presi/apps/backend/src/main.ts | 1 + apps/presi/apps/web/src/lib/api/client.ts | 3 ++- apps/presi/apps/web/vite.config.ts | 1 + apps/zitare/apps/web/vite.config.ts | 4 ++++ games/voxel-lava/apps/web/vite.config.ts | 4 ++++ 10 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.env.development b/.env.development index d8e3e2ad6..064efcb22 100644 --- a/.env.development +++ b/.env.development @@ -38,7 +38,7 @@ JWT_ACCESS_TOKEN_EXPIRY=15m JWT_REFRESH_TOKEN_EXPIRY=7d JWT_ISSUER=manacore JWT_AUDIENCE=manacore -CORS_ORIGINS=http://localhost:3000,http://localhost:3002,http://localhost:5173,http://localhost:5174,http://localhost:5175,http://localhost:5176,http://localhost:5177,http://localhost:5178,http://localhost:5179,http://localhost:8081 +CORS_ORIGINS=http://localhost:3000,http://localhost:3002,http://localhost:5173,http://localhost:5174,http://localhost:5175,http://localhost:5176,http://localhost:5177,http://localhost:5178,http://localhost:5179,http://localhost:5180,http://localhost:8081 CREDITS_SIGNUP_BONUS=150 CREDITS_DAILY_FREE=5 RATE_LIMIT_TTL=60 diff --git a/apps/chat/apps/web/vite.config.ts b/apps/chat/apps/web/vite.config.ts index 51bc7e814..53eb44fad 100644 --- a/apps/chat/apps/web/vite.config.ts +++ b/apps/chat/apps/web/vite.config.ts @@ -3,6 +3,10 @@ import { defineConfig } from 'vite'; export default defineConfig({ plugins: [sveltekit()], + server: { + port: 5174, + strictPort: true, + }, ssr: { noExternal: [ 'marked', diff --git a/apps/manacore/apps/web/vite.config.ts b/apps/manacore/apps/web/vite.config.ts index 7c8e939bb..b27d43722 100644 --- a/apps/manacore/apps/web/vite.config.ts +++ b/apps/manacore/apps/web/vite.config.ts @@ -5,10 +5,10 @@ export default defineConfig({ plugins: [sveltekit()], server: { port: 5173, - strictPort: false, + strictPort: true, }, preview: { port: 4173, - strictPort: false, + strictPort: true, }, }); diff --git a/apps/manadeck/apps/web/vite.config.ts b/apps/manadeck/apps/web/vite.config.ts index 8615d1e0f..d70cd606f 100644 --- a/apps/manadeck/apps/web/vite.config.ts +++ b/apps/manadeck/apps/web/vite.config.ts @@ -3,6 +3,10 @@ import { defineConfig } from 'vite'; export default defineConfig({ plugins: [sveltekit()], + server: { + port: 5176, + strictPort: true, + }, ssr: { noExternal: [ '@manacore/shared-theme', diff --git a/apps/picture/apps/web/vite.config.ts b/apps/picture/apps/web/vite.config.ts index 138c229a6..1a028b6b8 100644 --- a/apps/picture/apps/web/vite.config.ts +++ b/apps/picture/apps/web/vite.config.ts @@ -4,4 +4,8 @@ import { defineConfig } from 'vite'; export default defineConfig({ plugins: [tailwindcss(), sveltekit()], + server: { + port: 5175, + strictPort: true, + }, }); diff --git a/apps/presi/apps/backend/src/main.ts b/apps/presi/apps/backend/src/main.ts index 5d6a0dfcd..89aa7dc5f 100644 --- a/apps/presi/apps/backend/src/main.ts +++ b/apps/presi/apps/backend/src/main.ts @@ -11,6 +11,7 @@ async function bootstrap() { 'http://localhost:3000', 'http://localhost:5173', 'http://localhost:5177', + 'http://localhost:5178', // Presi web app 'http://localhost:8081', 'exp://localhost:8081', 'http://localhost:3001', // Mana Core Auth diff --git a/apps/presi/apps/web/src/lib/api/client.ts b/apps/presi/apps/web/src/lib/api/client.ts index 273cd3d31..0ba545b41 100644 --- a/apps/presi/apps/web/src/lib/api/client.ts +++ b/apps/presi/apps/web/src/lib/api/client.ts @@ -10,7 +10,8 @@ import type { ReorderSlidesDto, } from '@presi/shared'; -const API_URL = PUBLIC_BACKEND_URL || 'http://localhost:3008'; +const BASE_URL = PUBLIC_BACKEND_URL || 'http://localhost:3008'; +const API_URL = `${BASE_URL}/api`; const AUTH_URL = PUBLIC_MANA_CORE_AUTH_URL || 'http://localhost:3001'; function getToken(): string | null { diff --git a/apps/presi/apps/web/vite.config.ts b/apps/presi/apps/web/vite.config.ts index ea028a248..34599a24e 100644 --- a/apps/presi/apps/web/vite.config.ts +++ b/apps/presi/apps/web/vite.config.ts @@ -6,6 +6,7 @@ export default defineConfig({ plugins: [sveltekit()], server: { port: 5178, + strictPort: true, fs: { allow: [ // Allow serving files from the monorepo root node_modules diff --git a/apps/zitare/apps/web/vite.config.ts b/apps/zitare/apps/web/vite.config.ts index 368d7725a..6e4e64e79 100644 --- a/apps/zitare/apps/web/vite.config.ts +++ b/apps/zitare/apps/web/vite.config.ts @@ -3,6 +3,10 @@ import { defineConfig } from 'vite'; export default defineConfig({ plugins: [sveltekit()], + server: { + port: 5177, + strictPort: true, + }, ssr: { noExternal: [ '@zitare/shared', diff --git a/games/voxel-lava/apps/web/vite.config.ts b/games/voxel-lava/apps/web/vite.config.ts index fce9e8704..af547b7fa 100644 --- a/games/voxel-lava/apps/web/vite.config.ts +++ b/games/voxel-lava/apps/web/vite.config.ts @@ -3,4 +3,8 @@ import { defineConfig } from 'vite'; export default defineConfig({ plugins: [sveltekit()], + server: { + port: 5180, + strictPort: true, + }, });