From 385c46c241e8a9943a3b09ecbde96f0f65cc3cf3 Mon Sep 17 00:00:00 2001 From: AdamThomas Date: Thu, 10 Sep 2026 21:18:10 +0200 Subject: [PATCH] =?UTF-8?q?Vite=20:=20retirer=20le=20pr=C3=A9fixe=20/api?= =?UTF-8?q?=20avant=20de=20forwarder=20au=20backend?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Le proxy dev transmettait /api/editions/... tel quel → 404 (les routes du backend sont sous /editions/...). Ajout d'un `rewrite` qui enlève /api. --- frontend/vite.config.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 781ee04..63d8c3b 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -15,9 +15,12 @@ export default defineConfig({ host: true, port: 5173, proxy: { + // Le back-end expose ses routes sous `/editions/...` (pas `/api`) : + // on retire le préfixe avant de forwarder. '/api': { target: process.env.VITE_API_TARGET ?? 'http://localhost:8000', changeOrigin: true, + rewrite: (path) => path.replace(/^\/api/, ''), }, }, },