Skip to content

Commit

Permalink
allow CORS from PRSS CDN (#200554)
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomoreno authored Dec 12, 2023
1 parent 5d86561 commit 91a4378
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/vs/code/electron-main/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,24 @@ export class CodeApplication extends Disposable {

//#endregion

//#region Allow CORS for the PRSS CDN

// https://github.com/microsoft/vscode-remote-release/issues/9246
session.defaultSession.webRequest.onHeadersReceived((details, callback) => {
if (details.url.startsWith('https://vscode.download.prss.microsoft.com/')) {
const responseHeaders = details.responseHeaders ?? Object.create(null);

if (responseHeaders['Access-Control-Allow-Origin'] === undefined) {
responseHeaders['Access-Control-Allow-Origin'] = ['*'];
return callback({ cancel: false, responseHeaders });
}
}

return callback({ cancel: false });
});

//#endregion

//#region Code Cache

type SessionWithCodeCachePathSupport = Session & {
Expand Down

0 comments on commit 91a4378

Please sign in to comment.