From 13ac8a11f03158c034e6a8905af72599b9ed9b95 Mon Sep 17 00:00:00 2001 From: Pier-Jean Malandrino Date: Thu, 2 Apr 2026 12:44:08 +0200 Subject: [PATCH] Fix feature flag health check blocked by CORS Use relative /health path through Vite proxy instead of absolute URL to localhost:8000, matching the pattern used by all other API calls. --- frontend/src/features/feature-flags/store.test.ts | 4 ---- frontend/src/features/feature-flags/store.ts | 4 +--- frontend/vite.config.js | 4 ++++ 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/frontend/src/features/feature-flags/store.test.ts b/frontend/src/features/feature-flags/store.test.ts index 683ed87..aa5f7fb 100644 --- a/frontend/src/features/feature-flags/store.test.ts +++ b/frontend/src/features/feature-flags/store.test.ts @@ -7,10 +7,6 @@ vi.mock('../../shared/api/http', () => ({ apiFetch: (...args: unknown[]) => mockApiFetch(...args), })) -vi.mock('../settings/store', () => ({ - useSettingsStore: () => ({ apiUrl: 'http://localhost:8000' }), -})) - describe('useFeatureFlagStore', () => { beforeEach(() => { setActivePinia(createPinia()) diff --git a/frontend/src/features/feature-flags/store.ts b/frontend/src/features/feature-flags/store.ts index 3954faf..568609d 100644 --- a/frontend/src/features/feature-flags/store.ts +++ b/frontend/src/features/feature-flags/store.ts @@ -1,7 +1,6 @@ import { defineStore } from 'pinia' import { ref, computed } from 'vue' import { apiFetch } from '../../shared/api/http' -import { useSettingsStore } from '../settings/store' type ConversionEngine = 'local' | 'remote' @@ -44,9 +43,8 @@ export const useFeatureFlagStore = defineStore('feature-flags', () => { } async function load(): Promise { - const settings = useSettingsStore() try { - const data = await apiFetch(`${settings.apiUrl}/health`) + const data = await apiFetch('/health') engine.value = data.engine loaded.value = true error.value = null diff --git a/frontend/vite.config.js b/frontend/vite.config.js index a537ebb..9a8b9da 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -9,6 +9,10 @@ export default defineConfig({ '/api': { target: 'http://localhost:8000', changeOrigin: true + }, + '/health': { + target: 'http://localhost:8000', + changeOrigin: true } } }