Skip to content

Commit 96d9c5e

Browse files
authored
docs: add port-forwarding (#5979)
1 parent 134e9b4 commit 96d9c5e

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

docs/guide.md

+24-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- [Accessing web services](#accessing-web-services)
1515
- [Using a subdomain](#using-a-subdomain)
1616
- [Using a subpath](#using-a-subpath)
17+
- [Using your own proxy](#using-your-own-proxy)
1718
- [Stripping `/proxy/<port>` from the request path](#stripping-proxyport-from-the-request-path)
1819
- [Proxying to create a React app](#proxying-to-create-a-react-app)
1920
- [Proxying to a Vue app](#proxying-to-a-vue-app)
@@ -316,12 +317,32 @@ To set your domain, start code-server with the `--proxy-domain` flag:
316317
code-server --proxy-domain <domain>
317318
```
318319

319-
Now you can browse to `<port>.<domain>`. Note that this uses the host header, so
320-
ensure your reverse proxy (if you're using one) forwards that information.
320+
For instance, if you have code-server exposed on `domain.tld` and a Python
321+
server running on port 8080 of the same machine code-server is running on, you
322+
could run code-server with `--proxy-domain domain.tld` and access the Python
323+
server via `8080.domain.tld`.
324+
325+
Note that this uses the host header, so ensure your reverse proxy (if you're
326+
using one) forwards that information.
321327

322328
### Using a subpath
323329

324-
Simply browse to `/proxy/<port>/`.
330+
Simply browse to `/proxy/<port>/`. For instance, if you have code-server
331+
exposed on `domain.tld` and a Python server running on port 8080 of the same
332+
machine code-server is running on, you could access the Python server via
333+
`domain.tld/proxy/8000`.
334+
335+
### Using your own proxy
336+
337+
You can make extensions and the ports panel use your own proxy by setting
338+
`VSCODE_PROXY_URI`. For example if you set
339+
`VSCODE_PROXY_URI=https://{{port}}.kyle.dev` when an application is detected
340+
running on port 3000 of the same machine code-server is running on the ports
341+
panel will create a link to https://3000.kyle.dev instead of pointing to the
342+
built-in subpath-based proxy.
343+
344+
Note: relative paths are also supported i.e.
345+
`VSCODE_PROXY_URI=./proxy/{{port}}`
325346

326347
### Stripping `/proxy/<port>` from the request path
327348

0 commit comments

Comments
 (0)