Skip to content

Commit a3c23ed

Browse files
f0sselstirby
andauthored
chore: add docs for sharing ports (coder#13136)
Co-authored-by: kirby <kirby@coder.com> Co-authored-by: Stephen Kirby <me@skirby.dev>
1 parent 34a3bdc commit a3c23ed

File tree

5 files changed

+63
-11
lines changed

5 files changed

+63
-11
lines changed
302 KB
Loading
94.9 KB
Loading
Loading
109 KB
Loading

docs/networking/port-forwarding.md

Lines changed: 63 additions & 11 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,7 +90,68 @@ 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

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

104156
### Cross-origin resource sharing (CORS)
105157

0 commit comments

Comments
 (0)