feat: support reverse proxy path prefix deployments (#257)

* feat: support reverse proxy path prefixes

* fix: respect BASE_URL in SAML callback fallback

* fix: make BASE_URL runtime configurable
This commit is contained in:
ARUNAVO RAY
2026-04-09 12:32:59 +05:30
committed by GitHub
parent c87513b648
commit 01a3b08dac
58 changed files with 552 additions and 114 deletions

View File

@@ -1,7 +1,26 @@
---
import { BASE_PATH_WINDOW_KEY } from '@/lib/base-path';
const normalizeBasePath = (value) => {
if (!value || !value.trim()) {
return '/';
}
let normalized = value.trim();
if (!normalized.startsWith('/')) {
normalized = `/${normalized}`;
}
normalized = normalized.replace(/\/+$/, '');
return normalized || '/';
};
const runtimeBasePath = normalizeBasePath(process.env.BASE_URL);
---
<script is:inline>
<script is:inline define:vars={{ BASE_PATH_WINDOW_KEY, runtimeBasePath }}>
window[BASE_PATH_WINDOW_KEY] = runtimeBasePath;
const getThemePreference = () => {
if (typeof localStorage !== 'undefined' && localStorage.getItem('theme')) {
return localStorage.getItem('theme');