Skip to content

How to access host:port service running inside code-server via WebView #1949

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
anixon604 opened this issue Aug 7, 2020 · 2 comments
Closed

Comments

@anixon604
Copy link

  • Web Browser: Chrome
  • Local OS: OS X
  • Remote OS: Ubuntu
  • Remote Architecture: x64
  • code-server --version: 3.0.0

On creation of a code-server instance I have a springboot server auto-launch in the embedded terminal of VSCode, serving port 8580. This services is used by a custom extension.

In a local version of VSCode (non code-server) I can just have the extension WebView make calls to http://localhost:8580, but when using this base URL - export const SERVER_BASE_URL = "http://localhost:8580"; - through the code-server browser client, it doesn't direct to the INSTANCE/Container localhost - but rather to the USER's localhost.

Is there an easy method to have this service contained in the docker instance and accessed via a WebView in code-server?

My next step would be to expose 8580 externally and direct WebView calls to .domain.net:8580, but wondering if this is avoidable or if it can just all be contained. Thanks

@code-asher
Copy link
Member

code-server has a built-in proxy you could use to proxy port 8580. See https://github.com/cdr/code-server/blob/master/doc/FAQ.md#how-do-i-securely-access-web-services. That would at least let you avoid opening another port.

We have some open issues to make this easier: #1936 #1510

@nhooyr
Copy link
Contributor

nhooyr commented Aug 17, 2020

Yup, closing as a duplicate of #1936 and #1510

@nhooyr nhooyr closed this as completed Aug 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants