Port forwarding lets developers securely access processes on their Coder workspace from a local machine. A common use case is testing web applications in a browser.
There are three ways to forward ports in Coder:
coder port-forward command is generally more performant.
Forward the remote TCP port
8080 to local port
8000 like so:
coder port-forward myworkspace --tcp 8000:8080
For more examples, see
coder port-forward --help.
To enable port forwarding via the dashboard, Coder must be configured with a wildcard access URL.
Use the "Port forward" button in the dashboard to access ports running on your workspace.
First, configure SSH on your
local machine. Then, use
ssh to forward like so:
ssh -L 8080:localhost:8000 coder.myworkspace
You can read more on SSH port forwarding here.