Skip to content

Commit 72fe3ee

Browse files
committed
chore: add docs for sharing ports
1 parent 7779c0a commit 72fe3ee

File tree

4 files changed

+46
-10
lines changed

4 files changed

+46
-10
lines changed
302 KB
Loading
94.9 KB
Loading
109 KB
Loading

docs/networking/port-forwarding.md

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,9 @@ For more examples, see `coder port-forward --help`.
6060
> name, agent name, workspace name and username exceed 63 characters in the
6161
> hostname, port forwarding via the dashboard will not work.
6262
63-
### From an arbitrary port
64-
65-
One way to port forward in the dashboard is to use the "Port forward" button to
66-
specify an arbitrary port. Coder will also detect if apps inside the workspace
67-
are listening on ports, and list them below the port input (this is only
68-
supported on Windows and Linux workspace agents).
69-
70-
![Port forwarding in the UI](../images/port-forward-dashboard.png)
71-
7263
### From an coder_app resource
7364

74-
Another way to port forward is to configure a `coder_app` resource in the
65+
One way to port forward is to configure a `coder_app` resource in the
7566
workspace's template. This approach shows a visual application icon in the
7667
dashboard. See the following `coder_app` example for a Node React app and note
7768
the `subdomain` and `share` settings:
@@ -99,8 +90,53 @@ Valid `share` values include `owner` - private to the user, `authenticated` -
9990
accessible by any user authenticated to the Coder deployment, and `public` -
10091
accessible by users outside of the Coder deployment.
10192

93+
<!--- TODO: Update this image to match the rest on the page -->
10294
![Port forwarding from an app in the UI](../images/coderapp-port-forward.png)
10395

96+
### Accessing workspace ports
97+
98+
Another way to port forward in the dashboard is to use the "Open Ports" button to
99+
specify an arbitrary port. Coder will also detect if apps inside the workspace
100+
are listening on ports, and list them below the port input (this is only
101+
supported on Windows and Linux workspace agents).
102+
103+
![Port forwarding in the UI](../images/networking/listeningports.png)
104+
105+
#### Sharing ports
106+
107+
We allow developers to share ports as URLs, either with other authenticated coder users or publicly. Using the open ports interface, developers can assign a sharing levels that match our `coder_app`’s share option in [Coder terraform provider](https://registry.terraform.io/providers/coder/coder/latest/docs/resources/app#share).
108+
109+
- `owner` (Default): The implicit sharing level for all listening ports, only visible to the workspace owner
110+
- `authenticated`: Accessible by other authenticated Coder users on the same deployment.
111+
- `public`: Accessible by any user with the associated URL.
112+
113+
Once a port is shared at either `authenticated` or `public` levels, it will stay pinned in the open ports UI for better accessibility regardless of whether or not it is still accessible.
114+
115+
![Annotated port controls in the UI](../images/networking/annotatedports.png)
116+
117+
This can also be used to change the sharing level of `coder_app`s by entering their port number in the shared ports UI. The `share` attribute of `coder_app`s defined using the terraform provider can be overridden by sharing the port, but is limited by the maximum port sharing level enforced by the template (Enterprise).
118+
119+
By default, OSS deployments allow all workspaces to share ports at both the `authenticated` and `public` levels.
120+
121+
#### Configure sharing level (enterprise)
122+
123+
Enterprise-licensed template admins can control the maximum port sharing level for workspaces under a given template in the template settings. By default, the maximum sharing level is set to `Owner`, meaning port sharing is disabled for end-users.
124+
125+
![Max port sharing level in the UI](../images/networking/portsharingmax.png)
126+
127+
#### Configuring port protocol
128+
129+
Both listening and shared ports can be configured to use either `HTTP` or `HTTPS` to connect to the port. For listening ports the protocol selector applies to any port you input or select from the menu. Shared ports have protocol configuration for each shared port individually.
130+
131+
You can access any port on the workspace and can configure the port protocol manually by appending a `s` to the port in the URL.
132+
133+
```
134+
# Uses HTTP
135+
https://33295--agent--workspace--user--apps.example.com/
136+
# Uses HTTPS
137+
https://33295s--agent--workspace--user--apps.example.com/
138+
```
139+
104140
### Cross-origin resource sharing (CORS)
105141

106142
When forwarding via the dashboard, Coder automatically sets headers that allow

0 commit comments

Comments
 (0)