From 4d66065bdcdf6292c0df9aee827d6166406dadd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henry=20Gr=C3=A6sberg?= Date: Thu, 15 Oct 2026 22:06:59 +0200 Subject: [PATCH] Serve built public assets under the /project2 base path * The SSR HTML references assets at /project2/assets/... (from the Vite base), but Nitro bakes its static file routes from its own baseURL, which defaults to "/", so every asset request proxied through Apache hit the Node server and returned 404 * Set the Nitro baseURL to /project2/ so the built server serves its public dir under the base; non-prefixed paths such as /about now redirect with 307 to their base-prefixed location * Add a route rule so /project2/assets/** keeps the immutable one-year cache header, matching the automatic rule Nitro generates for /assets --- apps/frontend/vite.config.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/frontend/vite.config.ts b/apps/frontend/vite.config.ts index a9184f2..105a200 100644 --- a/apps/frontend/vite.config.ts +++ b/apps/frontend/vite.config.ts @@ -11,7 +11,17 @@ const config = defineConfig({ resolve: { tsconfigPaths: true }, plugins: [ devtools(), - nitro({ rollupConfig: { external: [/^@sentry\//] } }), + nitro({ + rollupConfig: { external: [/^@sentry\//] }, + baseURL: '/project2/', + routeRules: { + '/project2/assets/**': { + headers: { + 'cache-control': 'public, max-age=31536000, immutable', + }, + }, + }, + }), tailwindcss(), tanstackStart(), viteReact(),