From 104aeff216dc2605494039a4fafb758e0ce6cef3 Mon Sep 17 00:00:00 2001 From: vikingowl Date: Thu, 1 Jan 2026 10:00:18 +0100 Subject: [PATCH] fix: preserve query string in production API proxy The SvelteKit hooks proxy was only forwarding pathname without the query string (event.url.search), causing filters and pagination to be silently dropped in production builds. --- frontend/src/hooks.server.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/hooks.server.ts b/frontend/src/hooks.server.ts index fd6f72b..43fe455 100644 --- a/frontend/src/hooks.server.ts +++ b/frontend/src/hooks.server.ts @@ -67,14 +67,17 @@ export const handle: Handle = async ({ event, resolve }) => { return proxyRequest(event.request, BACKEND_URL, '/health'); } + // Include query string for all API proxying + const fullPath = pathname + event.url.search; + // Proxy /api/v1/* to backend (must come before /api/* check) if (pathname.startsWith('/api/v1/')) { - return proxyRequest(event.request, BACKEND_URL, pathname); + return proxyRequest(event.request, BACKEND_URL, fullPath); } // Proxy /api/* to Ollama if (pathname.startsWith('/api/')) { - return proxyRequest(event.request, OLLAMA_URL, pathname); + return proxyRequest(event.request, OLLAMA_URL, fullPath); } // All other requests go to SvelteKit