Closed madejackson closed 1 week ago
You need the "Strip Path Prefix" to be on, but it seems this option has broken I am assuming this happened when I hardened the API routes 2 releases ago need to take a look
Yeah I forgot to mention I tried with and without stripping and different paths, also "existing" ones on the app like /?folder= or /?folder=/ without path stripping. This did not work neither, though could be a different issue.
@azukaar
Short Update to this, it's definitely more broken than only strip path prefix. Issue is the same with filebrowser with /filebrowser as subpath configured (so no pathstrip).
Also another Issue with URL's: Custom CORS Origin seems to be ignored. Disable Header Hardening disables CORS though no matter the settings in Custom CORS Origin.
I can reproduce all of this in 0.15.7 and 0.16.0-beta.
I looked at it, the issue comes from code-server itself and generally speaking how path-based routing work (and why I designed Cosmos to highly discourage using this option, such as not having a "path" option in the market). Long story short, path based routing works as expected in Cosmos. I can create a route to code server that goes to /code-server and shows the app.
The issues you are seeing are:
If you are NOT enabling "strip-prefix" it is not working because Code-Server does not support "basepath" options. when you go to /code-server , it willl look for that path in the app itself and not find it, and show a 404. The rule is, any app that does not support basepath explicitly, will not work unless you strip the prefix (see next point)
If you DO enable strip prefix, you are essentially hacking the app into believing that request was done to domain.com
instead of domain.com/code-server
to force support for base paths. The issue is that you are really accessing /code-server but the app does not know this! In this case, the reason why you see the Cosmos UI when you go to /code-server, is because code-server has a redirection from "/code-server" to "/code-server/" (adding a trailing slash). EXCEPT you hacked code-server into believing it's running with no path (so domain.com
), so it will redirect you to domain.com/
instead of domain.com/code-server/
(and domain.com/ will just show the Cosmos UI). If you manually go domain.com/code-server/
instead (with the slash added manualy) then it will suddenly start working!
This kind of issues is why I just want people to use either ip:port, subdomains, or the newly added .local domains system. Base path DO NOT WORK with most apps, and there's nothing anyone can do about it except the dev of each apps who can add support for it.
What happened?
When I try to use a Path Prefix for Code-Server, it doesn't work.
What should have happened?
Code-Server supports sub-paths via proxy and does not need any config for that, it should just work. some Sources: https://github.com/coder/code-server/issues/1987 https://github.com/coder/code-server/issues/241 https://github.com/coder/code-server/discussions/1739
How to reproduce the bug?
Relevant log output
No response
Other details
tested with 0.15.7 and 0.16.0-unstable27
System details