You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add --base-path flag for use with absolute proxy #6770
This is not for code-server itself (since it works relatively), it would just be prepended to absproxy requests for applications that need the full path.
I answered in the other issue, but as mentioned above
This is not for code-server itself (since it works relatively), it would just be prepended to absproxy requests for applications that need the full path.
In other words, if you have an application on port 3000 and it requires absolute paths, and you have a reverse proxy serving code-server at /some/path, you can set --abs-proxy-base-path=/some/path, and then you can access your app with http://code-server.com/some/path/absproxy/3000.
Hope that helps!
Reacted by kimboslice99, waani, xieshuang and Twilighter9527
I think the long list of people that keep asking various questions on getting code-server to work under a base path should be a strong enough indicator that the docs are not thorough enough.
Fair. I believe it is confusing because there are potentially two proxies: the one that hosts code-server, and code-server's built-in proxy, for viewing webapps you are working on.
The base path flag is for code-server's built-in proxy. Nothing needs to be done to make code-server itself work behind another proxy, like Caddy or NGINX or so on.
We are open to PRs that clarify the docs. I think I may be too close to the source code to understand how to word them in a way that makes sense to other folks.
In other words, if you have an application on port 3000 and it requires absolute paths, and you have a reverse proxy serving code-server at /some/path, you can set --abs-proxy-base-path=/some/path, and then you can access your app with http://code-server.com/some/path/absproxy/3000.
By "doesn't seem to work" do you mean you get a blank page or 404 when you go to <domain>/usr/123/workspace?
code-server always listens at the root, you need a reverse proxy (NGINX, Caddy, etc) to rewrite the path to make code-server load at <domain>/usr/123/workspace.
The only thing --abs-proxy-base-path does is when you go to <domain>/usr/123/workspace/absproxy/<port>/<path> it will proxy to http://0.0.0.0:<port>/usr/123/workspace/<path> instead of http://0.0.0.0:<port>/<path>. It is a workaround for proxying applications you are developing that need to know the full path rather than working relatively, and has no effect on code-server itself.
By "doesn't seem to work" do you mean you get a blank page or 404 when you go to <domain>/usr/123/workspace?
code-server always listens at the root, you need a reverse proxy (NGINX, Caddy, etc) to rewrite the path to make code-server load at <domain>/usr/123/workspace.
The only thing --abs-proxy-base-path does is when you go to <domain>/usr/123/workspace/absproxy/<port>/<path> it will proxy to http://0.0.0.0:<port>/usr/123/workspace/<path> instead of http://0.0.0.0:<port>/<path>. It is a workaround for proxying applications you are developing that need to know the full path rather than working relatively, and has no effect on code-server itself.
yes, i get a 404 page when i go to /usr/123/workspace
You will need to use a reverse proxy like Caddy or NGINX to serve code-server on a subpath. For example with NGINX you can use https://github.com/coder/code-server/blob/main/docs/guide.md#using-lets-encrypt-with-nginx but change location / to location /context-path/ (for convenience you may want to also add a redirect from /context-path to /context-path/; the trailing slash is important so the relative requests resolve properly).
Activity
rafaelnferreira commentedon Aug 25, 2024
Hi @code-asher I've submitted a PR to resolve this case, could you have a look when you have a chance? Thanks
yuzhuoheng commentedon Oct 14, 2024
abs-proxy-base-path It didn't work. This is my startup command:


I tried to open it with a browser, and the page prompt was as follows:
code-asher commentedon Oct 15, 2024
I answered in the other issue, but as mentioned above
code-asher commentedon Oct 15, 2024
In other words, if you have an application on port 3000 and it requires absolute paths, and you have a reverse proxy serving code-server at
/some/path, you can set--abs-proxy-base-path=/some/path, and then you can access your app withhttp://code-server.com/some/path/absproxy/3000.Hope that helps!
kimboslice99 commentedon Feb 5, 2025
I think the long list of people that keep asking various questions on getting code-server to work under a base path should be a strong enough indicator that the docs are not thorough enough.
code-asher commentedon Feb 18, 2025
Fair. I believe it is confusing because there are potentially two proxies: the one that hosts code-server, and code-server's built-in proxy, for viewing webapps you are working on.
The base path flag is for code-server's built-in proxy. Nothing needs to be done to make code-server itself work behind another proxy, like Caddy or NGINX or so on.
We are open to PRs that clarify the docs. I think I may be too close to the source code to understand how to word them in a way that makes sense to other folks.
kuun993 commentedon Aug 6, 2025
This doesn't seem to work...
code-asher commentedon Aug 7, 2025
By "doesn't seem to work" do you mean you get a blank page or 404 when you go to
<domain>/usr/123/workspace?code-server always listens at the root, you need a reverse proxy (NGINX, Caddy, etc) to rewrite the path to make code-server load at
<domain>/usr/123/workspace.The only thing
--abs-proxy-base-pathdoes is when you go to<domain>/usr/123/workspace/absproxy/<port>/<path>it will proxy tohttp://0.0.0.0:<port>/usr/123/workspace/<path>instead ofhttp://0.0.0.0:<port>/<path>. It is a workaround for proxying applications you are developing that need to know the full path rather than working relatively, and has no effect on code-server itself.kuun993 commentedon Aug 10, 2025
yes, i get a 404 page when i go to /usr/123/workspace
For example:
command: code-server --auth none --bind-addr 0.0.0.0:8080 --abs-proxy-base-path /context-path
expect: get a normal page when i go to localhost:8080/context-path
actual: i get a 404 page when i go to localhost:8080/context-path
What should I do?
code-asher commentedon Aug 11, 2025
You will need to use a reverse proxy like Caddy or NGINX to serve code-server on a subpath. For example with NGINX you can use https://github.com/coder/code-server/blob/main/docs/guide.md#using-lets-encrypt-with-nginx but change
location /tolocation /context-path/(for convenience you may want to also add a redirect from/context-pathto/context-path/; the trailing slash is important so the relative requests resolve properly).feat(tabs,web): VS Code pane — daemon-managed code-server on the sess…
feat(tabs,web): VS Code pane — daemon-managed code-server on the sess…