From 437b14a90359234fa89ecef5a13991955920ebc0 Mon Sep 17 00:00:00 2001 From: Lukas Bockstaller Date: Mon, 20 May 2024 18:18:08 +0100 Subject: [PATCH] fix: relative url path for ui mode (#29924) This is a follow up #29564 I did a deep dive on a redirect issue I observed in my infrastructure and originally attributed to some configuration mistakes on my part. I have code hosted on `example.com/code` and use subdomain proxying. This leads to the uimode being exposed on `example.com/code/proxy/{{port}}`. Clicking on the open uimode link shown by vscode redirected with a 302 to `example.com/proxy/{{port}}` The absolute redirect url overruled the relative path handling reverse proxies rely on. This PR turns the absolute into a relative url to avoid this issue. --- packages/playwright-core/src/server/trace/viewer/traceViewer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/playwright-core/src/server/trace/viewer/traceViewer.ts b/packages/playwright-core/src/server/trace/viewer/traceViewer.ts index 9dce56b387..741a927757 100644 --- a/packages/playwright-core/src/server/trace/viewer/traceViewer.ts +++ b/packages/playwright-core/src/server/trace/viewer/traceViewer.ts @@ -132,7 +132,7 @@ export async function installRootRedirect(server: HttpServer, traceUrls: string[ for (const reporter of options.reporter || []) params.append('reporter', reporter); - const urlPath = `/trace/${options.webApp || 'index.html'}?${params.toString()}`; + const urlPath = `./trace/${options.webApp || 'index.html'}?${params.toString()}`; server.routePath('/', (_, response) => { response.statusCode = 302; response.setHeader('Location', urlPath);