fix and update
This commit is contained in:
@@ -7,16 +7,25 @@ function resolveBrowserApiBaseUrl(): string {
|
||||
return configuredApiUrl;
|
||||
}
|
||||
|
||||
try {
|
||||
const configured = new URL(configuredApiUrl);
|
||||
if (configured.hostname !== window.location.hostname) {
|
||||
return API_ORIGIN_PROXY_PREFIX;
|
||||
}
|
||||
} catch {
|
||||
// keep configured URL
|
||||
if (configuredApiUrl.startsWith('/')) {
|
||||
return configuredApiUrl.replace(/\/+$/, '') || API_ORIGIN_PROXY_PREFIX;
|
||||
}
|
||||
|
||||
return configuredApiUrl;
|
||||
try {
|
||||
const configured = new URL(configuredApiUrl);
|
||||
const sameHost =
|
||||
configured.hostname === window.location.hostname &&
|
||||
(configured.port || (configured.protocol === 'https:' ? '443' : '80')) ===
|
||||
(window.location.port || (window.location.protocol === 'https:' ? '443' : '80'));
|
||||
|
||||
if (sameHost) {
|
||||
return API_ORIGIN_PROXY_PREFIX;
|
||||
}
|
||||
|
||||
return configuredApiUrl.replace(/\/+$/, '');
|
||||
} catch {
|
||||
return API_ORIGIN_PROXY_PREFIX;
|
||||
}
|
||||
}
|
||||
|
||||
function resolveBrowserWsBaseUrl(): string {
|
||||
|
||||
Reference in New Issue
Block a user