base url support
I wanne run behind proxy
@yamajik I think there are already docs on how to run it behind a proxy https://github.com/codercom/code-server/blob/master/doc/self-hosted/index.md#user-content-nginx-reverse-proxy
I am managing many code servers behind a proxy. Each server serves with baseurl like “/code-server/:server_id/“ . But, some requests still do from root.
I wanne config for global baseurl setting
I just found code-server, and I want to give it a try, but without base url support it looks like I'll have to setup a separate subdomain for it on my website, which is pretty inconvenient.
@tiffany352 @yamajik have you tried using Docker with different IPs to see if it works as a temporary workaround? This is possible by creating a new network.
I also request this. It's a non-starter if I can't use it at another HTTP path, instead of /.
@sr229 that won't help. The issue is that you cannot set it up to be at http://myserver.foo/vscode/, rather it must be at http://myserver.foo/
I also would like this functionality to be added in, preferably as an environment variable such as BASE_URL
LetsEncrypt limits the number of SSL certs for subdomains on one host, thus taking up another subdomain is not preferable.
@sgama Off topic, but I'm kind of confused about your LE comment, I don't see any kind of limit other than (large) rate limits on certificate issuing? There's also wildcard certificates available now.
I ended up just making a new subdomain to run code-server on, and it's working fine.
@tiffany352, oh right. Wildcards are available now. Thanks for reminding me.
This should be fixed. The socket should now be created at the current page path.
Not sure.
resourse urls webview urls ...
Both incorrect.
I have fixed some in my fork.
reopen this, plz.
I will pr my fix later which may not fix all.
+1
We'll have to remove the /resource and replace it with resource/ to use subpaths.
+1 this will be a big help for us
@yamajik Thank you for the PR to add this feature. Any documentation on how we utilize this? Looking at your code it seems like you are fixing up the URLs? So if we have a server running behind a proxy pointing at something like http://
Index page is redirecting http://hostname/custombaseurl/ to http://hostname/login/ when it should be http://hostname/custombaseurl/login/
https://github.com/codercom/code-server/blob/c3a38e3fea8a28afa4017cf6c45ba12e82ff1feb/packages/server/src/server.ts#L233-L247
@yamajik Thank you for the PR to add this feature. Any documentation on how we utilize this? Looking at your code it seems like you are fixing up the URLs? So if we have a server running behind a proxy pointing at something like http:///patrickstjohn it would strip off patrickstjohn and things would work as if you were going to / directly?
@patrickstjohn http:///patrickstjohn Correct url?
In my case, I wanne run behind url http://example.com/some/path/to/code/server.
First, run code server on http://localhost:8443
Then, proxy all requrests(both http, https, ws, wss) from http://example.com/some/path/to/code/server to http://localhost:8443 (maybe by nginx)
In my pr, fixed all incorrect frontend urls I found. I should miss some.
Index page is redirecting
http://hostname/custombaseurl/tohttp://hostname/login/when it should behttp://hostname/custombaseurl/login/code-server/packages/server/src/server.ts
Lines 233 to 247 in c3a38e3
// If not authenticated, redirect to the login page. app.get("/", (req, res, next) => { if (!isAuthed(req)) { return redirect(req, res, "login"); } next(); });
// If already authenticated, redirect back to the root. app.get("/login", (req, res, next) => { if (isAuthed(req)) { return redirect(req, res, "", "login"); } next(); });
@au5ton Yelp. Miss one.
This is a wrong server url. Using relative path or adding a prefix path config both fix this. I prefer adding a prefix path config which may cause troubles in development.
Or u can run behind a reverse proxy server and do not mind it.