-
Notifications
You must be signed in to change notification settings - Fork 5.9k
feat: introduce --abs-proxy-base-path that allows app proxying while code-server is not server at the root #6958
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
Conversation
…code-server is not server at the root.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great thank you for implementing!
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6958 +/- ##
=======================================
Coverage ? 72.63%
=======================================
Files ? 31
Lines ? 1904
Branches ? 412
=======================================
Hits ? 1383
Misses ? 441
Partials ? 80
Continue to review full report in Codecov by Sentry.
|
Looks like our formatter is being a bit weird, let me fix it real quick Edit: actually not sure what is going on, CI seems to format a little differently compared to local...I will undo the indentation for now and figure it out later. |
Not sure why it keeps trying to indent the options though, in CI it wants it flat. Going to keep it flat for now until we figure it out.
This flag is just for code-server's built-in proxy (to proxy to other applications on the remote), not for code-server itself. To serve code-server itself at a base path, you should use a reverse proxy like NGINX or Caddy. |
@code-asher i've went through the related issue as well, and i wanted to know if you plan to make sub-path routing available OOB: |
No plans; at the moment our stance is that a reverse proxy should be used! But, if you have a compelling argument do let me know. From what I understand, it does not make sense to have this capability in code-server because you would have to listen on port 80/443, which means nothing else can be there, which means you might as well serve at the root anyway? So to use sub-path routing, you really need a reverse proxy to have it make any sense anyway. |
@code-asher gotcha attaching here a deploy+svc+ingress manifest that worked for me when attempting to launch code-server on a sub-path, for future reference: ---
apiVersion: apps/v1
kind: Deployment
metadata:
name: code-server
spec:
replicas: 1
selector:
matchLabels:
app: code-server
template:
metadata:
labels:
app: code-server
spec:
containers:
- name: code-server
image: ghcr.io/coder/code-server:latest
ports:
- containerPort: 8080
env:
- name: PASSWORD
value: "your-password-here"
- name: SUDO_PASSWORD
value: "your-sudo-password-here"
- name: BASE_URL
value: /hello/world
---
apiVersion: v1
kind: Service
metadata:
name: code-server
spec:
selector:
app: code-server
ports:
- port: 80
targetPort: 8080
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: code-server
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
rules:
- host: your.domain.com
http:
paths:
- path: /hello/world/?(.*)
pathType: ImplementationSpecific
backend:
service:
name: code-server
port:
number: 80 this will allow to serve your code-server container at |
I want to serve code-server on a subpath like I think it would be great if it could natively support subpath. |
What it is
code-server
is served under a path.How
abs-proxy-base-path
.absproxy
requests will be forwarded using the value as prefixExample
my-codeserver.com/user/123
PUBLIC_PATH
/user/123
abs-proxy-base-path
set to/user/123
GET
request tomy-codeserver.com/user/123/absproxy/8080/app
will properly reach the app.Fixes #6770