-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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.
abs-proxy-base-path It didn't work. This is my startup command:
企业微信截图_17288752683468
I tried to open it with a browser, and the page prompt was as follows:
企业微信截图_1728875413984
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.
itay-nvn-nv
commented
Nov 4, 2024
@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:
for example, allow serving on:https://blabla.com/testing/code-server/
instead of the currently expected FQDN: https://code-server.blabla.com/
without configuring reverse-proxy or any 3rd party tools.
This would be a great addition :) i'd be happy to contribute it myself as well, just wanted know your opinion first.
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 https://your.domain.com/hello/world/
shalldie
commented
Nov 22, 2024
I want to serve code-server on a subpath like /code
, but the ci/helm-chart
can't edit pathType in values.yaml
, which resulting in inability to rewrite.
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