Description
Updated by @jsjoeio
What's the problem I'm solving?
With the latest changes to use the upstream server in code-server, we're now running into issues with our reverse proxy not using the correct URL for the Log out functionality.. The specific code we're talking about lives here.
When using a reverse proxy (i.e. Caddy/NGINX), the /logout endpoint is incorrect because it has the wrong base path and protocol.
What are some ways to go about it?
The most ideal way to solve this is to use relative endpoints. This way, code-server doesn't care about the base path or protocol. It only knows and uses relative paths.
How will things change/what is the need for maintenance?
I am not sure if there is historical context I may be missing which would explain why we didn't use a relative path from the start (or rather why upstream didn't). Patching this in vscode
means it's something we'll need to keep an eye on as we continue staying in line with upstream.
I can't imagine this introducing any breaking changes but it could potentially break in specific environments if they don't support using relative paths for some reason 🤔 (though none specifically come to mind).
How to reproduce
Asher outlined steps below to reproduce this issue locally. To do so, follow these steps:
- install Caddy (
brew install caddy
) - start code-server locally with
yarn watch
- serve it at as base path like
/code
with Caddy
http://localhost:8082/code/* {
uri strip_prefix /code
reverse_proxy 127.0.0.1:8080
}
- navigate to http://localhost:8082/code/ (trailing slash is important!)
- Open the Menu and click Logout
Expected
You are redirected to http://mydomain.com/logout
Actual
You should be redirected to http://mydomain.com/code/logout
Should be similar to the fix for this issue. See PR here.