Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How do I change generated local address url in port forwarding? #5976

Answered by jsjoeio
Wireless4024 asked this question in Q&A
Discussion options

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.

You must be logged in to vote

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

Comment options

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!

You must be logged in to vote
7 replies
Comment options

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.

Comment options

@michaelkoelle
I am having the same issue. do you mind to share what you have to add in the template? thanks

Comment options

@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.

Comment options

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.

Comment options

ty, i updated the code above

Answer selected by Wireless4024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /