Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit081fbef

Browse files
authored
fix: code-server path based forwarding, defer to code-server (#11759)
Do not attempt to construct a path based port forward url.Always defer to code server, as it has it's own proxy method.
1 parent77a4792 commit081fbef

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

‎agent/agentssh/agentssh.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,11 @@ func (s *Server) CreateCommand(ctx context.Context, script string, env []string)
681681

682682
// This adds the ports dialog to code-server that enables
683683
// proxying a port dynamically.
684-
cmd.Env=append(cmd.Env,fmt.Sprintf("VSCODE_PROXY_URI=%s",manifest.VSCodePortProxyURI))
684+
// If this is empty string, do not set anything. Code-server auto defaults
685+
// using its basepath to construct a path based port proxy.
686+
ifmanifest.VSCodePortProxyURI!="" {
687+
cmd.Env=append(cmd.Env,fmt.Sprintf("VSCODE_PROXY_URI=%s",manifest.VSCodePortProxyURI))
688+
}
685689

686690
// Hide Coder message on code-server's "Getting Started" page
687691
cmd.Env=append(cmd.Env,"CS_DISABLE_GETTING_STARTED_OVERRIDE=true")

‎coderd/agentapi/manifest.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,14 @@ func (a *ManifestAPI) GetManifest(ctx context.Context, _ *agentproto.GetManifest
150150
}
151151

152152
funcvscodeProxyURI(app appurl.ApplicationURL,accessURL*url.URL,appHoststring)string {
153-
// This will handle the ports from the accessURL or appHost.
154-
appHost=appurl.SubdomainAppHost(appHost,accessURL)
155-
// If there is no appHost, then we want to use the access url as the proxy uri.
153+
// Proxying by port only works for subdomains. If subdomain support is not
154+
// available, return an empty string.
156155
ifappHost=="" {
157-
appHost=accessURL.Host
156+
return""
158157
}
158+
159+
// This will handle the ports from the accessURL or appHost.
160+
appHost=appurl.SubdomainAppHost(appHost,accessURL)
159161
// Return the url with a scheme and any wildcards replaced with the app slug.
160162
returnaccessURL.Scheme+"://"+strings.ReplaceAll(appHost,"*",app.String())
161163
}

‎coderd/agentapi/manifest_internal_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,18 @@ func Test_vscodeProxyURI(t *testing.T) {
3535
Expectedstring
3636
}{
3737
{
38-
// No hostname proxies through the access url.
3938
Name:"NoHostname",
4039
AccessURL:coderAccessURL,
4140
AppHostname:"",
4241
App:basicApp,
43-
Expected:coderAccessURL.String(),
42+
Expected:"",
4443
},
4544
{
4645
Name:"NoHostnameAccessURLPort",
4746
AccessURL:accessURLWithPort,
4847
AppHostname:"",
4948
App:basicApp,
50-
Expected:accessURLWithPort.String(),
49+
Expected:"",
5150
},
5251
{
5352
Name:"Hostname",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp