From 56a697c887b446b623ce39a9a9a41f731e0c0dc9 Mon Sep 17 00:00:00 2001 From: Lewis Sanchez <87730006+lewis-sanchez@users.noreply.github.com> Date: Thu, 11 Nov 2021 11:04:00 -0800 Subject: [PATCH] Resolves same-origin-policy violation when ADS web is running in a container (#17555) * Stops appending port to authority for web mode * Clarifies comment * Adds missing sql carbon edit tag --- src/vs/base/common/network.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vs/base/common/network.ts b/src/vs/base/common/network.ts index 0f059da2be..79dbf07f71 100644 --- a/src/vs/base/common/network.ts +++ b/src/vs/base/common/network.ts @@ -94,6 +94,8 @@ export namespace Schemas { } class RemoteAuthoritiesImpl { + private readonly _defaultWebPort = 80; // {{SQL CARBON EDIT}} + private readonly _hosts: { [authority: string]: string | undefined; } = Object.create(null); private readonly _ports: { [authority: string]: number | undefined; } = Object.create(null); private readonly _connectionTokens: { [authority: string]: string | undefined; } = Object.create(null); @@ -134,7 +136,7 @@ class RemoteAuthoritiesImpl { } return URI.from({ scheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource, - authority: `${host}:${port}`, + authority: platform.isWeb && port === this._defaultWebPort ? `${host}` : `${host}:${port}`, // {{SQL CARBON EDIT}} addresses same-origin-policy violation in web mode when port number is in authority, but not in URI. path: `/vscode-remote-resource`, query });