diff --git a/app/vmui/packages/vmui/src/utils/default-server-url.ts b/app/vmui/packages/vmui/src/utils/default-server-url.ts index c6f98e8b7c..7a23b64433 100644 --- a/app/vmui/packages/vmui/src/utils/default-server-url.ts +++ b/app/vmui/packages/vmui/src/utils/default-server-url.ts @@ -8,7 +8,7 @@ export const getDefaultServer = (tenantId?: string): string => { const { serverURL } = getAppModeParams(); const storageURL = getFromStorage("SERVER_URL") as string; const logsURL = window.location.href.replace(/\/(select\/)?(vmui)\/.*/, ""); - const anomalyURL = window.location.href.replace(/(?:graph|vmui)\/.*/, ""); + const anomalyURL = `${window.location.origin}${window.location.pathname}`; const defaultURL = window.location.href.replace(/\/(?:prometheus\/)?(?:graph|vmui)\/.*/, "/prometheus"); const url = serverURL || storageURL || defaultURL; @@ -16,7 +16,7 @@ export const getDefaultServer = (tenantId?: string): string => { case AppType.logs: return logsURL; case AppType.anomaly: - return serverURL || storageURL || anomalyURL; + return storageURL || anomalyURL; default: return tenantId ? replaceTenantId(url, tenantId) : url; }