Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
aeschli committed Jan 7, 2025
1 parent 69b1e04 commit d9dcfa2
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/vs/server/node/webClientServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -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;
Expand All @@ -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<IProductConfiguration>;
Expand All @@ -353,15 +349,15 @@ 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,
enableWorkspaceTrust: !this._environmentService.args['disable-workspace-trust'],
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 || '');
Expand All @@ -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 ---------------------------------------------------------------------------------------
Expand Down

0 comments on commit d9dcfa2

Please sign in to comment.