feat: add BASE_PATH env var for serving UI from a subpath
All checks were successful
CI / cleanup-branch (push) Has been skipped
CI / build (push) Successful in 1m9s
CI / docker (push) Successful in 1m4s
CI / deploy-feature (push) Has been skipped
CI / deploy (push) Successful in 37s

When BASE_PATH is set (e.g., /server/), the entrypoint script injects
a <base> tag and rewrites asset paths in index.html. React Router reads
the basename from the <base> tag. Vite builds with relative paths.
Default / for standalone mode (no changes).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-05 21:04:28 +02:00
parent 3c70313d78
commit 51abe45fba
4 changed files with 32 additions and 1 deletions

View File

@@ -41,6 +41,8 @@ function LegacyAgentRedirect() {
return <Navigate to={path} replace />;
}
const basename = document.querySelector('base')?.getAttribute('href')?.replace(/\/$/, '') || '';
export const router = createBrowserRouter([
{ path: '/login', element: <LoginPage /> },
{ path: '/oidc/callback', element: <OidcCallback /> },
@@ -101,4 +103,4 @@ export const router = createBrowserRouter([
},
],
},
]);
], { basename: basename || undefined });