From 86cea5d6c48c5b812da251c16b37d826949df272 Mon Sep 17 00:00:00 2001 From: Agent Zero Date: Sat, 12 Sep 2026 00:32:42 +0200 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20Interceptor=20normalisiert=20A?= =?UTF-8?q?LLE=20apiClient-URLs=20=E2=80=94=20auch=20Direktaufrufe=20und?= =?UTF-8?q?=20Cache-Alte-Chunks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Der apiX-Wrapper-Fix (744f2a1) heilte nur Wrapper-Aufrufe. Produktion-Logs zeigten: POST /api/v1/api/v1/ai-proactive/context → 405 (4x vom User- Browser mit alten gecachten Chunks). Der Request-Interceptor strippt jetzt redundante /api/v1-Präfixe auf Transport-Ebene — heilt auch Direkt- apiClient-Calls und stale Cache-Artefakte transparent. --- frontend/src/api/client.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frontend/src/api/client.ts b/frontend/src/api/client.ts index ae5515f..bff62c0 100644 --- a/frontend/src/api/client.ts +++ b/frontend/src/api/client.ts @@ -47,6 +47,16 @@ export function setValidationErrorHandler(handler: (errors: Record { + // Normalize URLs: strip a redundant leading '/api/v1' when it collides + // with the axios baseURL '/api/v1' (double-prefix → 404/405). Done here + // in the interceptor (not only in the apiX wrappers) so DIRECT apiClient + // calls are covered too — stale browser-cache chunks keep calling with + // full prefixes after deploys and this heals them transparently. + if (typeof config.url === 'string' && config.url.startsWith('/api/v1/')) { + config.url = config.url.slice('/api/v1'.length); + } else if (config.url === '/api/v1') { + config.url = '/'; + } // Attach CSRF token on unsafe methods const unsafe = ['post', 'put', 'patch', 'delete']; if (unsafe.includes(config.method?.toLowerCase() ?? '') && csrfToken) {