-
Notifications
You must be signed in to change notification settings - Fork 6.3k
How do I change generated local address url in port forwarding? #5976
-
I'm using code-server in coder,
by default auto forward will generate local address such as http://localhost:{PORT}, coder have config to use wildcard subdomain but I don't want to use it.
so I want to change it to be something like {CURRENT_URL}/proxy/{PORT} instead, how do I achieve this? (url that I want is accessible if I type it manually)
if this is coder's problem or have soluion to do please let me know.
Beta Was this translation helpful? Give feedback.
All reactions
Great question! Apologies for not having this in the docs or easier to find. This is where it's documented: https://github.com/coder/code-server/releases/tag/v4.8.0
So you'll want to set VSCODE_PROXY_URI=https://your-url/proxy/{{port}} as an environment variable. Let me know if you have any issues!
Replies: 1 comment 7 replies
-
Great question! Apologies for not having this in the docs or easier to find. This is where it's documented: https://github.com/coder/code-server/releases/tag/v4.8.0
So you'll want to set VSCODE_PROXY_URI=https://your-url/proxy/{{port}} as an environment variable. Let me know if you have any issues!
Beta Was this translation helpful? Give feedback.
All reactions
-
Thank you, i was setting the environment variable in my coder helm values. Instead i should have set it in the template within coder and now it works. I was trying to get port-forwarding without a wildcard cert to work, but currently it can only be done via subdomains. From the doc:
To enable port forwarding via the dashboard, Coder must be configured with a wildcard access URL.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
@michaelkoelle
I am having the same issue. do you mind to share what you have to add in the template? thanks
Beta Was this translation helpful? Give feedback.
All reactions
-
@michaelkoelle I am having the same issue. do you mind to share what you have to add in the template? thanks
I edited the default kubernetes terraform template and added the env variable like this:
env {
name = "VSCODE_PROXY_URI"
value = "https://your-url/proxy/{{port}}/"
}
Code-server now has the correct link under the forwarded ports section. Unfortunately, coder does not know about this route and I could not access the container via the link.
Beta Was this translation helpful? Give feedback.
All reactions
-
Hi,
I think the value in VSCODE_PROXY_URI is missing a trailing / at the end.
It should look like this:
https://your-url/proxy/{{port}}/
When I start the python server with python3 -m http.server 8000 on a folder and open a file with the url, i am redirected to:
https://your-url/proxy/8000/helloworld.html.
Without the / at the end, the port is not recognized as a uri path segment and https://your-url/proxy/hello.html is called, with an invalid port message from code-server.
I don't know if that has any side effects.
Beta Was this translation helpful? Give feedback.
All reactions
-
ty, i updated the code above
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1