Skip to content

Commit 433ff31

Browse files
committed
fix: skip uri modification if authority host match
This adds a check in our `resolveExternalUri` patch to skip modifying if the `authority` and the `location.host` match to prevent `localhost:<port>/proxy/<port>` from being modified.
1 parent 6db1bd0 commit 433ff31

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

patches/proxy-uri.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
134134
+ credentialsProvider: config.remoteAuthority ? undefined : new LocalStorageCredentialsProvider(), // with a remote, we don't use a local credentials provider
135135
+ resolveExternalUri: (uri: URI): Promise<URI> => {
136136
+ let resolvedUri = uri
137-
+ const localhostMatch = extractLocalHostUriMetaDataForPortMapping(uri)
137+
+ const localhostMatch = extractLocalHostUriMetaDataForPortMapping(resolvedUri)
138138
+
139139
+ if (localhostMatch) {
140-
+ if (config.productConfiguration && config.productConfiguration.proxyEndpointTemplate) {
140+
+ if ((resolvedUri.authority !== location.host) && config.productConfiguration && config.productConfiguration.proxyEndpointTemplate) {
141141
+ resolvedUri = URI.parse(new URL(config.productConfiguration.proxyEndpointTemplate.replace('{{port}}', localhostMatch.port.toString()), window.location.href).toString())
142142
+ } else {
143143
+ throw new Error(`Failed to resolve external URI: ${uri.toString()}. Could not determine base url because productConfiguration missing.`)

0 commit comments

Comments
 (0)