8000 feat: Let port-forwarding support custom http(s) port · coder/coder@4f8a9b9 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 4f8a9b9

Browse files
committed
feat: Let port-forwarding support custom http(s) port
1 parent 69e8c9e commit 4f8a9b9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

coderd/workspaceagents.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ func (api *API) workspaceAgentMetadata(rw http.ResponseWriter, r *http.Request)
123123
workspace.Name,
124124
owner.Username,
125125
))
126+
if api.AccessURL.Port() != "" {
127+
vscodeProxyURI += fmt.Sprintf(":%s", api.AccessURL.Port())
128+
}
126129

127130
httpapi.Write(ctx, rw, http.StatusOK, codersdk.WorkspaceAgentMetadata{
128131
Apps: convertApps(dbApps),

coderd/workspaceapps.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,13 @@ const (
4040
)
4141

4242
func (api *API) appHost(rw http.ResponseWriter, r *http.Request) {
43+
host := api.AppHostname
44+
if api.AccessURL.Port() != "" {
45+
host += fmt.Sprintf(":%s", api.AccessURL.Port())
46+
}
47+
4348
httpapi.Write(r.Context(), rw, http.StatusOK, codersdk.GetAppHostResponse{
44-
Host: api.AppHostname,
49+
Host: host,
4550
})
4651
}
4752

0 commit comments

Comments
 (0)
0