From ecaf1609c376bdf612123242de209cea9b517abe Mon Sep 17 00:00:00 2001 From: Chris Scott Date: Mon, 24 Nov 2025 00:19:36 -0500 Subject: [PATCH] fix: remove hardcoded port, require VITE_API_URL env var - Remove default localhost:8080 fallback from API_BASE_URL - Make VITE_API_URL required for proper functionality - Update .env.example to clarify required configuration - Ensure no hardcoded ports exist in frontend --- .env.example | 4 ++-- frontend/src/constants/api.ts | 2 +- frontend/vite.config.ts | 7 +------ 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.env.example b/.env.example index 4ca94e85..967e083d 100644 --- a/.env.example +++ b/.env.example @@ -44,9 +44,9 @@ MAX_UPLOAD_SIZE_MB=50 DEBUG=false # ============================================ -# Frontend Configuration (for development) +# Frontend Configuration (REQUIRED) # ============================================ # Backend API URL - frontend connects to this -# Note: In development, Vite proxies /api requests to the backend +# Must include full URL with port (e.g., http://localhost:8080) VITE_API_URL=http://localhost:8080 diff --git a/frontend/src/constants/api.ts b/frontend/src/constants/api.ts index 47523c00..5819cce9 100644 --- a/frontend/src/constants/api.ts +++ b/frontend/src/constants/api.ts @@ -1,4 +1,4 @@ -export const API_BASE_URL = import.meta.env.VITE_API_URL || 'http://localhost:8080' +export const API_BASE_URL = import.meta.env.VITE_API_URL export const OPENCODE_API_ENDPOINT = import.meta.env.VITE_API_URL ? `${import.meta.env.VITE_API_URL}/api/opencode` diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 1aac6d41..7201a61e 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -22,12 +22,7 @@ export default defineConfig({ target: process.env.VITE_API_URL, changeOrigin: true, }, - } : { - '/api': { - target: 'http://localhost:8080', - changeOrigin: true, - }, - }, + } : undefined, }, build: { assetsInlineLimit: 4096,