fix: resolve diagnostic paths under the base path prefix and tolerate health-style ping responses
This commit is contained in:
@@ -423,7 +423,10 @@ export function validateOperationalWorkspace(workspace: unknown): WorkspaceV3 {
|
||||
export function resolveDiagnosticUrl(baseUrl: string, path: string): URL {
|
||||
if (!isOriginRelativeDiagnosticPath(path)) throw new Error("Diagnostic path must remain on the configured origin");
|
||||
const base = new URL(baseUrl);
|
||||
const resolved = new URL(path, base);
|
||||
// Resolve the origin-relative path beneath the configured base path (e.g. `/dwh/`), not the
|
||||
// origin root: a leading slash must append to the base path instead of resetting it.
|
||||
const basePath = base.pathname.endsWith("/") ? base.pathname : `${base.pathname}/`;
|
||||
const resolved = new URL(`${basePath}${path.replace(/^\/+/, "")}`, base.origin);
|
||||
if (resolved.origin !== base.origin) throw new Error("Diagnostic URL must remain on the configured origin");
|
||||
return resolved;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user