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.
This commit is contained in:
Lukas Bockstaller 2024-05-20 18:18:08 +01:00 committed by GitHub
parent 7fd3539ebd
commit 437b14a903
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);