Skip to content

fix(webClientServer): use relative path in logoutEndpointUrl #137762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 40 commits into from

Conversation

jsjoeio
Copy link
Contributor

@jsjoeio jsjoeio commented Nov 23, 2021

Description

This patches the webClientServer to ensure the logoutEndpointUrl is relative to the root.
This ensures the correct URL in case code-server is being served behind a
reverse proxy.

An example of this would be using Caddy to server code-server on
localhost:8082/code/

This fix ensures logging out makes a request to localhost:8082/code/logout instead
of localhost:8082/logout

Video

Before

After

Testing Plan

I tested against the root and the reverse-proxy.

  1. cd vscode && git checkout jsjoeio-fix-csp-reverse-proxy
  2. yarn link
  3. cd code-server && yarn link code-oss-dev --modules-folder vendor/modules
  4. create Caddyfile somewhere:
http://localhost:8082/code/* {
  uri strip_prefix /code
  reverse_proxy 127.0.0.1:8080
}
  1. caddy run
  2. Navigate to http://localhost:8082/code/ in the browser
  3. Open Menu and click Sign out

This PR fixes https://github.com/cdr/code-server/issues/4476

(There is a chance this fixes other reverse proxy issues, but I will test after this is merged).

GirlBossRush and others added 30 commits November 4, 2021 11:59
I was getting module issues again.  See
#4 for details.
Make tweaks for code server integration
This way we can import it instead of the reh agent server which does not
include the directory creation logic we need.
When we pass it in we check for cert or link but that means any
self-hosted reverse proxies will not work.

Pull the information from the headers instead so it works generically.
In practice this may not be necessary since we patch connections from
the client to use the current URL instead of referencing the remote
authority anyway.

I also replaced a — because a git hook was complaining about it and
preventing me from committing.
Turns out we used to already do this and if you passed the flag you
would actually *disable* the global enable setting.  This is because we
were defaulting to an empty array which means to enable it globally.

Fixes coder/code-server#4397
Fixes coder/code-server#4480
- Added product config to client, iframe config.
@jsjoeio jsjoeio closed this Nov 23, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jan 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants