Skip to content

Commit fc84189

Browse files
authored
fix: remove path-based port proxying (#4063)
1 parent 6e9c05f commit fc84189

File tree

2 files changed

+6
-22
lines changed

2 files changed

+6
-22
lines changed

coderd/workspaceapps.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ func (api *API) workspaceAppsProxyPath(rw http.ResponseWriter, r *http.Request)
3838
chiPath = "/" + chiPath
3939
}
4040

41-
appName, port := httpapi.AppNameOrPort(chi.URLParam(r, "workspaceapp"))
4241
api.proxyWorkspaceApplication(proxyApplication{
43-
Workspace: workspace,
44-
Agent: agent,
45-
AppName: appName,
46-
Port: port,
42+
Workspace: workspace,
43+
Agent: agent,
44+
// We do not support port proxying for paths.
45+
AppName: chi.URLParam(r, "workspaceapp"),
46+
Port: 0,
4747
Path: chiPath,
4848
DashboardOnError: true,
4949
}, rw, r)

coderd/workspaceapps_test.go

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func setupProxyTest(t *testing.T) (*codersdk.Client, uuid.UUID, codersdk.Workspa
129129

130130
func TestWorkspaceAppsProxyPath(t *testing.T) {
131131
t.Parallel()
132-
client, orgID, workspace, port := setupProxyTest(t)
132+
client, orgID, workspace, _ := setupProxyTest(t)
133133

134134
t.Run("LoginWithoutAuth", func(t *testing.T) {
135135
t.Parallel()
@@ -209,22 +209,6 @@ func TestWorkspaceAppsProxyPath(t *testing.T) {
209209
require.Equal(t, http.StatusOK, resp.StatusCode)
210210
})
211211

212-
t.Run("ProxiesPort", func(t *testing.T) {
213-
t.Parallel()
214-
215-
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
216-
defer cancel()
217-
218-
path := fmt.Sprintf("/@me/%s/apps/%d/?%s", workspace.Name, port, proxyTestAppQuery)
219-
resp, err := client.Request(ctx, http.MethodGet, path, nil)
220-
require.NoError(t, err)
221-
defer resp.Body.Close()
222-
body, err := io.ReadAll(resp.Body)
223-
require.NoError(t, err)
224-
require.Equal(t, proxyTestAppBody, string(body))
225-
require.Equal(t, http.StatusOK, resp.StatusCode)
226-
})
227-
228212
t.Run("ProxyError", func(t *testing.T) {
229213
t.Parallel()
230214

0 commit comments

Comments
 (0)