You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// 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
}
It strips the base path from the request, assuming the application behind the proxy does 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 a 404 as you hit / on the app, where it expects /@Emyrk/workspace.main/apps/code-server/
Solution
We should have an option on coder_app to not 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.
When you configure a
coder_app
that is path based, Coderd will always strip the subpath from the proxied request.So when you hit
The app sees the request as:
This happens in the code here:
coder/coderd/workspaceapps/proxy.go
Lines 284 to 290 in 36fa80c
It strips the base path from the request, assuming the application behind the proxy does 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 on
coder_app
to not 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)
Why do this
This will expand support for more path based applications.
Would fix this: coder/modules#288
The text was updated successfully, but these errors were encountered: