From d9dcfa212ff1d8708d375e4d9be5b8687a1a6886 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Tue, 7 Jan 2025 17:19:52 +0100 Subject: [PATCH] update --- src/vs/server/node/webClientServer.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/vs/server/node/webClientServer.ts b/src/vs/server/node/webClientServer.ts index 5ce490dc139472..b94fbc3e99f7e4 100644 --- a/src/vs/server/node/webClientServer.ts +++ b/src/vs/server/node/webClientServer.ts @@ -306,7 +306,7 @@ export class WebClientServer { } // Prefix routes with basePath for clients - const basePath = getFirstHeader('x-forwarded-prefix') || this._basePath; + const serverBasePath = posix.join(getFirstHeader('x-forwarded-prefix') || this._basePath, this._productPath); if (this._logService.getLevel() === LogLevel.Trace) { ['x-original-host', 'x-forwarded-host', 'x-forwarded-port', 'host'].forEach(header => { @@ -315,13 +315,9 @@ export class WebClientServer { this._logService.trace(`[WebClientServer] ${header}: ${value}`); } }); - this._logService.trace(`[WebClientServer] Request URL: ${req.url}, basePath: ${basePath}, remoteAuthority: ${remoteAuthority}`); + this._logService.trace(`[WebClientServer] Request URL: ${req.url}, serverBasePath: ${serverBasePath}, remoteAuthority: ${remoteAuthority}`); } - const staticRoute = posix.join(basePath, this._productPath, STATIC_PATH); - const callbackRoute = posix.join(basePath, this._productPath, CALLBACK_PATH); - const webExtensionRoute = posix.join(basePath, this._productPath, WEB_EXTENSION_PATH); - const resolveWorkspaceURI = (defaultLocation?: string) => defaultLocation && URI.file(path.resolve(defaultLocation)).with({ scheme: Schemas.vscodeRemote, authority: remoteAuthority }); const filePath = FileAccess.asFileUri(`vs/code/browser/workbench/workbench${this._environmentService.isBuilt ? '' : '-dev'}.html`).fsPath; @@ -339,7 +335,7 @@ export class WebClientServer { resourceUrlTemplate: this._webExtensionResourceUrlTemplate.with({ scheme: 'http', authority: remoteAuthority, - path: `${webExtensionRoute}/${this._webExtensionResourceUrlTemplate.authority}${this._webExtensionResourceUrlTemplate.path}` + path: posix.join(serverBasePath, WEB_EXTENSION_PATH, `${this._webExtensionResourceUrlTemplate.authority}${this._webExtensionResourceUrlTemplate.path}`) }).toString(true) } : undefined } satisfies Partial; @@ -353,7 +349,7 @@ export class WebClientServer { const workbenchWebConfiguration = { remoteAuthority, - serverBasePath: basePath, + serverBasePath, _wrapWebWorkerExtHostInIframe, developmentOptions: { enableSmokeTestDriver: this._environmentService.args['enable-smoke-test-driver'] ? true : undefined, logLevel: this._logService.getLevel() }, settingsSyncOptions: !this._environmentService.isBuilt && this._environmentService.args['enable-sync'] ? { enabled: true } : undefined, @@ -361,7 +357,7 @@ export class WebClientServer { folderUri: resolveWorkspaceURI(this._environmentService.args['default-folder']), workspaceUri: resolveWorkspaceURI(this._environmentService.args['default-workspace']), productConfiguration, - callbackRoute: callbackRoute + callbackRoute: posix.join(serverBasePath, CALLBACK_PATH) }; const cookies = cookie.parse(req.headers.cookie || ''); @@ -378,9 +374,9 @@ export class WebClientServer { const values: { [key: string]: string } = { WORKBENCH_WEB_CONFIGURATION: asJSON(workbenchWebConfiguration), WORKBENCH_AUTH_SESSION: authSessionInfo ? asJSON(authSessionInfo) : '', - WORKBENCH_WEB_BASE_URL: staticRoute, + WORKBENCH_WEB_BASE_URL: posix.join(serverBasePath, STATIC_PATH), WORKBENCH_NLS_URL, - WORKBENCH_NLS_FALLBACK_URL: `${staticRoute}/out/nls.messages.js` + WORKBENCH_NLS_FALLBACK_URL: posix.join(serverBasePath, STATIC_PATH, 'out/nls.messages.js') }; // DEV ---------------------------------------------------------------------------------------