code-server: Unable to connect with --link

#2704 isn’t resolved, sorry.

code-server --link
[2021-02-10T16:53:51.032Z] info  HTTP server listening on http://**127.0.0.1**:32947 (randomized by --link)

There no way --link can access my server at 127.0.0.1, as it’s hosted remotely. It only works on 0.0.0.0.

I normally launch code-server using the --host 0.0.0.0 flag to enable this, however I would like to make use of --link which currently only launches with a host of 127.0.0.1 (internal/local network).

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 36 (8 by maintainers)

Most upvoted comments

To make sure I’m hearing you correctly, you would like to be able to set the host flag with --link?

Yes, I would expect to run:

code-server --host 0.0.0.0 --link

Thanks, Mike

Although we don’t know yet if everyone’s issues are caused by the same problem I’m going to close this in favor of https://github.com/cdr/code-server/issues/2734 for now so we can track progress in one place.

No, link is not supposed to be running behind a reverse proxy, it was created to eliminate the need for one.

On Mon, Feb 22, 2021 at 1:04 PM Mike notifications@github.com wrote:

Sorry, I did mean, when using the --link flag is it also expected that my installation will be behind a reverse proxy? (Nginx / Caddy etc.)

On Mon, 22 Feb 2021, 02:39 Samuel Hepworth, notifications@github.com wrote:

In all honesty, I’m not really sure what you mean by “behind a webserver”.

Code-server is the webserver, it’s the thing that serving all of the data to the browser. You run it on localhost so that nginx or whatever can use the port to make a reverse proxy which has a certificate, making the connection secure. Very oversimplified though.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cdr/code-server/issues/2708#issuecomment-782998857, or unsubscribe < https://github.com/notifications/unsubscribe-auth/ANFXY4I6YD6U3WA4FFK6PZ3TAG7UXANCNFSM4XNKEEPQ

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cdr/code-server/issues/2708#issuecomment-783215664, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLUVG5QOQA3BWICSFOKHU3TAIM3BANCNFSM4XNKEEPQ .

One other detail that might help understand how this works is that the agent dials out to the cloud rather than having a request come into the server like how a traditional reverse proxy usually functions. This is why --link will work even if all incoming ports are firewalled off or if it’s not even being routed to at all.

Have you accessed the URL that --link outputs?

It is not necessary for code-server to bind to 0.0.0.0. The cloud agent proxies to code-server and runs on the same machine so it’s able to access code-server at 127.0.0.1. I hope that helps explain it!

If you have accessed the URL that --link outputs and it’s not working please post details on the error you’re getting. Thanks!