feat: add BASE_PATH env var for serving UI from a subpath
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:
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user