Forward remote ports to your local machine via SSH tunnels
The pw forward command creates SSH tunnels that make remote ports accessible on your local machine. This uses the same mechanism as the -L option in OpenSSH.
Unlike pw ssh -L, this command automatically reconnects if the SSH connection is interrupted. Local listeners stay open across reconnects, so client programs only see a brief interruption rather than a closed port. This makes it ideal for long-lived tunnels.
Resource names can be specified in the following formats:
pw forward -L [bind_address:]port:host:hostport [-L ...] <resource> [flags]
# Make remote port 8080 accessible at localhost:8080
pw forward -L 8080:localhost:8080 my-cluster
# Forward multiple remote ports
pw forward -L 5900:localhost:5901 -L 3000:localhost:3000 my-cluster
# Bind to all interfaces (accessible from other machines on your network)
pw forward -L 0.0.0.0:8080:localhost:8080 my-cluster
# Forward a port from your user workspace
pw forward -L 8080:localhost:8080 workspace
-h, --help help for forward
--keepalive int Interval in seconds between keepalive messages (0 to disable) (default 30)
-L, --local stringArray Forward a remote port to your local machine [bind_address:]port:host:hostport (required, repeatable)
--context string The context to use. Overrides PW_CONTEXT environment variable and current context from config.
--platform-host string The Parallel Works ACTIVATE platform host to use. Will override any other platform host settings.
-v, --verbose Enable verbose logging