@@ -124,7 +124,7 @@ func (api *API) workspaceAppsProxyPath(rw http.ResponseWriter, r *http.Request)
124
124
chiPath = "/" + chiPath
125
125
}
126
126
127
- ticket , ok := api . WorkspaceAppsProvider . ResolveRequest (rw , r , workspaceapps.Request {
127
+ token , ok := workspaceapps . ResolveRequest (api . Logger , api . AccessURL , api . WorkspaceAppsProvider , rw , r , workspaceapps.Request {
128
128
AccessMethod : workspaceapps .AccessMethodPath ,
129
129
BasePath : basePath ,
130
130
UsernameOrID : chi .URLParam (r , "user" ),
@@ -137,7 +137,7 @@ func (api *API) workspaceAppsProxyPath(rw http.ResponseWriter, r *http.Request)
137
137
return
138
138
}
139
139
140
- api .proxyWorkspaceApplication (rw , r , * ticket , chiPath )
140
+ api .proxyWorkspaceApplication (rw , r , * token , chiPath )
141
141
}
142
142
143
143
// handleSubdomainApplications handles subdomain-based application proxy
@@ -247,7 +247,7 @@ func (api *API) handleSubdomainApplications(middlewares ...func(http.Handler) ht
247
247
return
248
248
}
249
249
250
- ticket , ok := api . WorkspaceAppsProvider . ResolveRequest (rw , r , workspaceapps.Request {
250
+ token , ok := workspaceapps . ResolveRequest (api . Logger , api . AccessURL , api . WorkspaceAppsProvider , rw , r , workspaceapps.Request {
251
251
AccessMethod : workspaceapps .AccessMethodSubdomain ,
252
252
BasePath : "/" ,
253
253
UsernameOrID : app .Username ,
@@ -263,7 +263,7 @@ func (api *API) handleSubdomainApplications(middlewares ...func(http.Handler) ht
263
263
// app.
264
264
mws := chi .Middlewares (middlewares )
265
265
mws .Handler (http .HandlerFunc (func (rw http.ResponseWriter , r * http.Request ) {
266
- api .proxyWorkspaceApplication (rw , r , * ticket , r .URL .Path )
266
+ api .proxyWorkspaceApplication (rw , r , * token , r .URL .Path )
267
267
})).ServeHTTP (rw , r .WithContext (ctx ))
268
268
})
269
269
}
@@ -561,7 +561,7 @@ func (api *API) setWorkspaceAppCookie(rw http.ResponseWriter, r *http.Request, t
561
561
return true
562
562
}
563
563
564
- func (api * API ) proxyWorkspaceApplication (rw http.ResponseWriter , r * http.Request , ticket workspaceapps.Ticket , path string ) {
564
+ func (api * API ) proxyWorkspaceApplication (rw http.ResponseWriter , r * http.Request , appToken workspaceapps.SignedToken , path string ) {
565
565
ctx := r .Context ()
566
566
567
567
// Filter IP headers from untrusted origins.
@@ -573,12 +573,12 @@ func (api *API) proxyWorkspaceApplication(rw http.ResponseWriter, r *http.Reques
573
573
return
574
574
}
575
575
576
- appURL , err := url .Parse (ticket .AppURL )
576
+ appURL , err := url .Parse (appToken .AppURL )
577
577
if err != nil {
578
578
site .RenderStaticErrorPage (rw , r , site.ErrorPageData {
579
579
Status : http .StatusBadRequest ,
580
580
Title : "Bad Request" ,
581
- Description : fmt .Sprintf ("Application has an invalid URL %q: %s" , ticket .AppURL , err .Error ()),
581
+ Description : fmt .Sprintf ("Application has an invalid URL %q: %s" , appToken .AppURL , err .Error ()),
582
582
RetryEnabled : true ,
583
583
DashboardURL : api .AccessURL .String (),
584
584
})
@@ -592,7 +592,7 @@ func (api *API) proxyWorkspaceApplication(rw http.ResponseWriter, r *http.Reques
592
592
portInt , err := strconv .Atoi (port )
593
593
if err != nil {
594
594
httpapi .Write (ctx , rw , http .StatusBadRequest , codersdk.Response {
595
- Message : fmt .Sprintf ("App URL %q has an invalid port %q." , ticket .AppURL , port ),
595
+ Message : fmt .Sprintf ("App URL %q has an invalid port %q." , appToken .AppURL , port ),
596
596
Detail : err .Error (),
597
597
})
598
598
return
@@ -639,7 +639,7 @@ func (api *API) proxyWorkspaceApplication(rw http.ResponseWriter, r *http.Reques
639
639
})
640
640
}
641
641
642
- conn , release , err := api .workspaceAgentCache .Acquire (ticket .AgentID )
642
+ conn , release , err := api .workspaceAgentCache .Acquire (appToken .AgentID )
643
643
if err != nil {
644
644
site .RenderStaticErrorPage (rw , r , site.ErrorPageData {
645
645
Status : http .StatusBadGateway ,
0 commit comments