1
0
mirror of synced 2025-12-23 03:44:00 -05:00
Files
docs/content/codespaces/developing-in-codespaces/forwarding-ports-in-your-codespace.md
Amy Burns c70adf6702 Codespaces Megabranch - Docs audit and re-org, Landing and Guides page, Secrets doc (#19227)
* reorganizing security and access sections

* updating delete doc

* making vscode doc moore os agnostic

* updating developing in a codespace

* fixing broken links

* fixing some broken links

* fixing broken topic

* fixing broken link

* Managing users permissions for your organization and other stuff (#19231)

* Add new 'Managing user permissions for your organization' article

* Revise 'Managing access and security for Codespaces' and screenshot

* Add codespaces to org repo permissions article

* Apply suggestions from code review

Co-authored-by: Amy Burns <timeyoutakeit@github.com>

* fixing title to match slug

* fixing broken link

* updating personalization doc

* updating troubleshooting guide

* updating creating doc

* adding information about when secrets are used

* removing secrets stuff from this PR

* Addig order of operations for codespaces

* self review fixes

* Apply suggestions from code review

Co-authored-by: Allison Weins <3174849+2percentsilk@users.noreply.github.com>

* renaming quickstart to correct pattern:

* Apply suggestions from code review

Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>

* rewriting re. review comments

* Codespaces landingpage (#19053)

* adding new tables and linking to info on audit logs

* editing some text:

* adding new info on how to add image registry login

* adding link and fixing table

* formatting

* formatting

* Apply suggestions from code review

Co-authored-by: Laura Coursen <lecoursen@github.com>

* updaing private image registry secret info and other improvements

* some minor fixes

* fixing test errors

* rewriting registry secret section

* rewriting registry secret section

* updating link to reflect title

* Update content/github/developing-online-with-codespaces/managing-encrypted-secrets-for-codespaces.md

Co-authored-by: Laura Coursen <lecoursen@github.com>

* updating bullet point

* moving codespaces to top-level item

* fixing duplicated redirect

* Adding some organization for contributors

* adding learning codespaces to index file

* do not error out if category array is empty

* Apply suggestions from code review

Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com>

* fixing broken link

* testing what is possible for the landing page

* adding first run of landing page

* adding new video and intro text

* add landing page scaffolding

* Update codespaces_code_examples.yml

* lint

* fixing issues in branch

* fixing nav

* fixing broken directs

* Creating guides sub-landing page

* adding topics

* removing unused toopic

* removing instant

* updating landing page and guides page

* updating versioning

* removing unused topic

* removing other versions:

* actually fixing broken links

* fixing title

* fixing intro to suit the landing page

* Apply suggestions from code review

Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>

* adding video

* adding video

* adding correct link for video

* removing duplicated guides

Co-authored-by: Laura Coursen <lecoursen@github.com>
Co-authored-by: Sarah Schneider <sarahs@github.com>
Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com>
Co-authored-by: Rachael Sewell <rachmari@github.com>
Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>

* rewording and reorganizing code samples

* fixing some feedback from engineering

* Adding doc on Secrets in codespaces (#19248)

* adding secrets docs

* fixing some broken links

* fixing some more broken redirects

* copy edit and updating limits for secrets

* adding limits for users

* Apply suggestions from code review

Co-authored-by: Felicity Chapman <felicitymay@github.com>

* adding feedback

Co-authored-by: Felicity Chapman <felicitymay@github.com>

* updating beta banner

* adding quickstarts to landing page

* removing availability section from reusable

Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>
Co-authored-by: Allison Weins <3174849+2percentsilk@users.noreply.github.com>
Co-authored-by: Laura Coursen <lecoursen@github.com>
Co-authored-by: Sarah Schneider <sarahs@github.com>
Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com>
Co-authored-by: Rachael Sewell <rachmari@github.com>
Co-authored-by: Felicity Chapman <felicitymay@github.com>
2021-05-11 17:29:34 +00:00

68 lines
3.8 KiB
Markdown

---
title: Forwarding ports in your codespace
intro: '{% data reusables.codespaces.about-port-forwarding %}'
versions:
free-pro-team: '*'
redirect_from:
- /github/developing-online-with-codespaces/forwarding-ports-in-your-codespace
type: how_to
topics:
- Codespaces
- Fundamentals
- Developer
---
{% data reusables.codespaces.release-stage %}
### About forwarded ports
Port forwarding gives you access to TCP ports running within your codespace. For example, if you're running a web application on port 4000, you can access the application from your browser to test and debug the application.
When an application running inside a codespace outputs a port to the console, {% data variables.product.prodname_codespaces %} detects the localhost URL pattern and automatically forwards the port. You can click on the URL in the terminal to open the port in a browser. For example, if an application outputs `http://127.0.0.1:4000` or `http://localhost:4000` to the console, the log would automatically convert the output to a clickable URL for port 4000.
![Automatic port forwarding](/assets/images/help/codespaces/automatic-port-forwarding.png)
You can also forward a port manually, label forwarded ports, share fowarded ports publicly, and add forwarded ports to the codespace configuration.
### Forwarding a port
You can manually forward a port that wasn't forwarded automatically.
{% data reusables.codespaces.navigate-to-ports-tab %}
1. Under the list of ports, click **Add port**.
![Add port button](/assets/images/help/codespaces/add-port-button.png)
1. Type the port number or address, then press enter.
![Text box to type port button](/assets/images/help/codespaces/port-number-text-box.png)
### Labeling a port
You can label a port to make the port more easily identifiable in a list.
{% data reusables.codespaces.navigate-to-ports-tab %}
1. Hover over the port you want to label, then click the label icon.
![Label icon for port](/assets/images/help/codespaces/label-icon.png)
{% data reusables.codespaces.type-port-label %}
### Sharing a port
If you want to share a forwarded port with others, you can make the port public. After you make a port public, anyone with the port's URL can view the running application without needing to authenticate.
{% data reusables.codespaces.navigate-to-ports-tab %}
1. Right click the port you want to share, then click **Make Public**.
![Option to make port public in right-click menu](/assets/images/help/codespaces/make-public-option.png)
1. To the right of the local address for the port, click the copy icon.
![Copy icon for port URL](/assets/images/help/codespaces/copy-icon-port-url.png)
1. Send the copied URL to the person you want to share the port with.
### Adding a port to the codespace configuration
You can add a forwarded port to the {% data variables.product.prodname_codespaces %} configuration for the repository, so the port will automatically be forwarded for all codespaces created from the repository. After you update the configuration, any previously created codespaces must be rebuilt for the change to apply. For more information, see "[Configuring {% data variables.product.prodname_codespaces %} for your project](/codespaces/setting-up-your-codespace/configuring-codespaces-for-your-project#applying-changes-to-your-configuration)."
You can manually configure fowarded ports in a `.devcontainer.json` file using the `forwardPorts` property, or you can use the "Ports" panel in your codespace.
{% data reusables.codespaces.navigate-to-ports-tab %}
1. Right click the port you want to add to the codespace configuration, then click **Set Label and Update devcontainer.json**.
![Option to set label and add port to devcontainer.json in the right-click menu](/assets/images/help/codespaces/update-devcontainer-to-add-port-option.png)
{% data reusables.codespaces.type-port-label %}