# Work Summary: CORS Error Resolution **Date:** 2026-01-20 **Status:** RESOLVED ## Problem User experiencing CORS error when attempting to login from the web UI at `http://localhost:3000`. The error was preventing requests from reaching the API server at `http://localhost:8080`. ## Root Cause The issue had multiple contributing factors: 1. **Environment variable override**: `web/.env.development` had `VITE_API_BASE_URL=http://localhost:8080` set, which overrode the code configuration 2. **Generated API client hardcoded values**: `web/src/api/core/OpenAPI.ts` (auto-generated file) had hardcoded `BASE: 'http://localhost:8080'` 3. **Alternative API client**: `web/src/lib/api-client.ts` also had hardcoded base URL 4. **Login form UX issue**: Submit button was `type="button"` instead of `type="submit"`, preventing Enter key submission ## Solution ### 1. Fixed Environment Configuration **File:** `web/.env.development` Changed from: ``` VITE_API_BASE_URL=http://localhost:8080 ``` To: ``` # Use empty/omit VITE_API_BASE_URL to use Vite proxy (recommended for local dev) # VITE_API_BASE_URL= ``` This ensures the Vite proxy is used for local development, avoiding CORS entirely. ### 2. Fixed Generated OpenAPI Client **File:** `web/src/api/core/OpenAPI.ts` Changed: ```typescript export const OpenAPI: OpenAPIConfig = { BASE: "http://localhost:8080", // ❌ Wrong WITH_CREDENTIALS: false, // ❌ Wrong ``` To: ```typescript export const OpenAPI: OpenAPIConfig = { BASE: "", // ✅ Correct - uses proxy WITH_CREDENTIALS: true, // ✅ Correct - sends credentials ``` **Note:** This is a generated file, so it will be overwritten when running `npm run generate:api`. The fix in `api-config.ts` (which runs after) ensures correct values are set at runtime. ### 3. Fixed Manual API Client **File:** `web/src/lib/api-client.ts` Changed: ```typescript const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:8080'; ``` To: ```typescript const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || ""; ``` Also fixed the refresh token endpoint to use relative URL when BASE_URL is empty. ### 4. Fixed Login Form UX **File:** `web/src/pages/auth/LoginPage.tsx` Changed: ```typescript