From deb163ff38c080cd254c2a5ef03035fd42bc2f3b Mon Sep 17 00:00:00 2001 From: Cian Hughes Date: Thu, 23 Jan 2025 16:21:56 +0000 Subject: [PATCH] Test of hook approach to solve sveltekit routing issues with reverse proxy --- src/hooks.server.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/hooks.server.js diff --git a/src/hooks.server.js b/src/hooks.server.js new file mode 100644 index 0000000..3f23a95 --- /dev/null +++ b/src/hooks.server.js @@ -0,0 +1,12 @@ +export const handle = async ({ event, resolve }) => { + // Paths to be handled by proxy + const proxyPaths = ["repo"]; + + if (proxyPaths.some(path => event.url.pathname.startsWith(path))) { + // Return empty response, letting proxy handle it + return new Response(null, { status: 404 }); + } + + // Let SvelteKit handle other paths + return resolve(event); +};