@@ -111,29 +111,23 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
111
111
===================================================================
112
112
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
113
113
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
114
- @@ -271,16 +271,15 @@ export class WebClientServer {
115
- return void res.end();
116
- }
114
+ @@ -285,10 +285,14 @@ export class WebClientServer {
115
+ };
117
116
118
- - const getFirstHeader = (headerName: string) => {
119
- - const val = req.headers[headerName];
120
- - return Array.isArray(val) ? val[0] : val;
121
- - };
122
- -
123
117
const useTestResolver = (!this._environmentService.isBuilt && this._environmentService.args['use-test-resolver']);
124
118
+ // For now we are getting the remote authority from the client to avoid
125
119
+ // needing specific configuration for reverse proxies to work. Set this to
126
120
+ // something invalid to make sure we catch code that is using this value
127
121
+ // from the backend when it should not.
128
- const remoteAuthority = (
122
+ let remoteAuthority = (
129
123
useTestResolver
130
124
? 'test+test'
131
125
- : (getFirstHeader('x-original-host') || getFirstHeader('x-forwarded-host') || req.headers.host)
132
126
+ : 'remote'
133
127
);
134
128
if (!remoteAuthority) {
135
129
return serveError(req, res, 400, `Bad request.`);
136
- @@ -307 ,8 +306 ,12 @@ export class WebClientServer {
130
+ @@ -333 ,8 +337 ,12 @@ export class WebClientServer {
137
131
scopes: [['user:email'], ['repo']]
138
132
} : undefined;
139
133
@@ -146,30 +140,30 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
146
140
embedderIdentifier: 'server-distro',
147
141
extensionsGallery: this._webExtensionResourceUrlTemplate && this._productService.extensionsGallery ? {
148
142
...this._productService.extensionsGallery,
149
- @@ -337 ,7 +340 ,7 @@ export class WebClientServer {
143
+ @@ -363 ,7 +371 ,7 @@ export class WebClientServer {
150
144
folderUri: resolveWorkspaceURI(this._environmentService.args['default-folder']),
151
145
workspaceUri: resolveWorkspaceURI(this._environmentService.args['default-workspace']),
152
146
productConfiguration,
153
- - callbackRoute: this._callbackRoute
154
- + callbackRoute: vscodeBase + this._callbackRoute
147
+ - callbackRoute: callbackRoute
148
+ + callbackRoute: vscodeBase + callbackRoute
155
149
};
156
150
157
151
const cookies = cookie.parse(req.headers.cookie || '');
158
- @@ -354 ,9 +357 ,11 @@ export class WebClientServer {
152
+ @@ -380 ,9 +388 ,11 @@ export class WebClientServer {
159
153
const values: { [key: string]: string } = {
160
154
WORKBENCH_WEB_CONFIGURATION: asJSON(workbenchWebConfiguration),
161
155
WORKBENCH_AUTH_SESSION: authSessionInfo ? asJSON(authSessionInfo) : '',
162
- - WORKBENCH_WEB_BASE_URL: this._staticRoute ,
163
- + WORKBENCH_WEB_BASE_URL: vscodeBase + this._staticRoute ,
156
+ - WORKBENCH_WEB_BASE_URL: staticRoute ,
157
+ + WORKBENCH_WEB_BASE_URL: vscodeBase + staticRoute ,
164
158
WORKBENCH_NLS_URL,
165
- - WORKBENCH_NLS_FALLBACK_URL: `${this._staticRoute }/out/nls.messages.js`
166
- + WORKBENCH_NLS_FALLBACK_URL: `${vscodeBase}${this._staticRoute }/out/nls.messages.js`,
159
+ - WORKBENCH_NLS_FALLBACK_URL: `${staticRoute }/out/nls.messages.js`
160
+ + WORKBENCH_NLS_FALLBACK_URL: `${vscodeBase}${staticRoute }/out/nls.messages.js`,
167
161
+ BASE: base,
168
162
+ VS_BASE: vscodeBase,
169
163
};
170
164
171
165
// DEV ---------------------------------------------------------------------------------------
172
- @@ -393 ,7 +398 ,7 @@ export class WebClientServer {
166
+ @@ -419 ,7 +429 ,7 @@ export class WebClientServer {
173
167
'default-src \'self\';',
174
168
'img-src \'self\' https: data: blob:;',
175
169
'media-src \'self\';',
@@ -178,7 +172,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
178
172
'child-src \'self\';',
179
173
`frame-src 'self' https://*.vscode-cdn.net data:;`,
180
174
'worker-src \'self\' data: blob:;',
181
- @@ -466 ,3 +471 ,70 @@ export class WebClientServer {
175
+ @@ -492 ,3 +502 ,70 @@ export class WebClientServer {
182
176
return void res.end(data);
183
177
}
184
178
}
0 commit comments