- Notifications
You must be signed in to change notification settings - Fork906
Description
When you configure acoder_app
that is path based, Coderd will always strip the subpath from the proxied request.
So when you hit
GET /@Emyrk/workspace.main/apps/code-server/
The app sees the request as:
GET /
This happens in the code here:
coder/coderd/workspaceapps/proxy.go
Lines 284 to 290 in36fa80c
// Determine the real path that was hit. The * URL parameter in Chi will not | |
// include the leading slash if it was present, so we need to add it back. | |
chiPath:=chi.URLParam(r,"*") | |
basePath:=strings.TrimSuffix(r.URL.Path,chiPath) | |
ifstrings.HasSuffix(basePath,"/") { | |
chiPath="/"+chiPath | |
} |
Itstrips the base path from the request, assuming the application behind the proxydoes not want this base path.
However
Many applications like VSCode Web support flags like--server-base-path
, which allows hosting an application on a subpath. This is required, because all urls made from the app are absolute.
So today, if you do not configure--server-base-path
, the app will fail to load resources, since it constructs urls from"/"
. And if you configure the base path, our proxy strips that, so you get a404
as you hit/
on the app, where it expects/@Emyrk/workspace.main/apps/code-server/
Solution
We should have an option oncoder_app
tonot strip the base path from proxied requests. Some boolean like:url_passthrough
to tell the proxy service to not alter the request url in any way.
Some other apps that would require this (off the top of my head)
- RStudio
- Jupyter (pretty sure)
Why do this
This will expand support for more path based applications.
Would fix this:coder/modules#288