Skip to content

Commit

Permalink
fix: skip uri modification if authority host match
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jsjoeio committed Oct 20, 2022
1 parent 231eb89 commit b98bebb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions patches/proxy-uri.diff
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.ts
+ credentialsProvider: config.remoteAuthority ? undefined : new LocalStorageCredentialsProvider(), // with a remote, we don't use a local credentials provider
+ resolveExternalUri: (uri: URI): Promise<URI> => {
+ let resolvedUri = uri
+ const localhostMatch = extractLocalHostUriMetaDataForPortMapping(uri)
+ const localhostMatch = extractLocalHostUriMetaDataForPortMapping(resolvedUri)
+
+ if (localhostMatch) {
+ if (config.productConfiguration && config.productConfiguration.proxyEndpointTemplate) {
+ if ((resolvedUri.authority !== location.host) && config.productConfiguration && config.productConfiguration.proxyEndpointTemplate) {
+ resolvedUri = URI.parse(new URL(config.productConfiguration.proxyEndpointTemplate.replace('{{port}}', localhostMatch.port.toString()), window.location.href).toString())
+ } else {
+ throw new Error(`Failed to resolve external URI: ${uri.toString()}. Could not determine base url because productConfiguration missing.`)
Expand Down

0 comments on commit b98bebb

Please sign in to comment.