-
Notifications
You must be signed in to change notification settings - Fork 6k
docs: add port-forwarding #5979
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
985212d
docs: add port-forwarding
jsjoeio a637e75
fixup: formatting
jsjoeio b2e683c
Update docs/guide.md
jsjoeio 077ad34
docs: clean up based on feedback
jsjoeio c10d0cb
docs: add relative paths paragraph
jsjoeio cdb2934
Remove dupe paragraph and fill paragraph
code-asher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
- [Accessing web services](#accessing-web-services) | ||
- [Using a subdomain](#using-a-subdomain) | ||
- [Using a subpath](#using-a-subpath) | ||
- [Using your own proxy](#using-your-own-proxy) | ||
- [Stripping `/proxy/<port>` from the request path](#stripping-proxyport-from-the-request-path) | ||
- [Proxying to create a React app](#proxying-to-create-a-react-app) | ||
- [Proxying to a Vue app](#proxying-to-a-vue-app) | ||
|
@@ -300,6 +301,11 @@ If you're working on web services and want to access them locally, code-server | |
can proxy to any port using either a subdomain or a subpath, allowing you to | ||
securely access these services using code-server's built-in authentication. | ||
|
||
By default, ports running on the same machine as code-server can be accessed at | ||
{current_url}/proxy/{port}. For instance, if you have code-server running on | ||
localhost:8080 and a Python server running on localhost:8000, you could access | ||
it via http://localhost:8080/proxy/8000 | ||
|
||
code-asher marked this conversation as resolved.
Show resolved
Hide resolved
|
||
### Using a subdomain | ||
|
||
You will need a DNS entry that points to your server for each port you want to | ||
|
@@ -316,12 +322,29 @@ To set your domain, start code-server with the `--proxy-domain` flag: | |
code-server --proxy-domain <domain> | ||
``` | ||
|
||
Now you can browse to `<port>.<domain>`. Note that this uses the host header, so | ||
For instance, if you have code-server exposed on `domain.tld` and a Python | ||
server running on port 8080 of the same machine code-server is running on, you | ||
could run code-server with `--proxy-domain domain.tld` and access the Python | ||
server via `8080.domain.tld`. | ||
|
||
Note that this uses the host header, so | ||
code-asher marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ensure your reverse proxy (if you're using one) forwards that information. | ||
|
||
### Using a subpath | ||
|
||
Simply browse to `/proxy/<port>/`. | ||
Simply browse to `/proxy/<port>/`. For instance, if you have code-server | ||
exposed on `domain.tld` and a Python server running on port 8080 of the same | ||
machine code-server is running on, you could access the Python server via | ||
`domain.tld/proxy/8000`. | ||
|
||
### Using your own proxy | ||
|
||
You can make extensions and the ports panel use your own proxy by setting | ||
`VSCODE_PROXY_URI`. For example if you set | ||
`VSCODE_PROXY_URI=https://{{port}}.kyle.dev` when an application is detected | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. relative path like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TIL! I'll add that. Thank you :) |
||
running on port 3000 of the same machine code-server is running on the ports | ||
panel will create a link to https://3000.kyle.dev instead of pointing to the | ||
built-in subpath-based proxy. | ||
|
||
### Stripping `/proxy/<port>` from the request path | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.