pw forward
pw forward
Forward remote ports to your local machine via SSH tunnels
Synopsis
The pw forward command creates SSH tunnels that make remote ports accessible on your local machine. This uses the same mechanism as the -L and -D options in OpenSSH.
-D starts a local SOCKS5 proxy whose connections leave from the remote resource, so a browser or other SOCKS-aware program pointed at it reaches everything the resource can.
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. A connection whose server stops answering keepalives is detected as dead, torn down, and re-established automatically.
Resource names can be specified in the following formats:
- pw://username/name - full format with explicit username
- pw://name - managed cluster by name in your organization
- name - short format where username defaults to your username
- workspace - your user workspace
- worker/id - compute node running one of your workers, as listed by pw workers ls
pw forward [-L [bind_address:]port:host:hostport ...] [-D [bind_address:]port ...] <resource> [flags]Examples
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
# Start a SOCKS5 proxy on localhost:1080 that exits from the cluster
pw forward -D 1080 my-clusterOptions
-D, --dynamic stringArray Start a SOCKS5 proxy on local [bind_address:]port whose connections are dialed from the remote (repeatable)
-h, --help help for forward
--keepalive int Interval in seconds between keepalive messages; an unresponsive connection is torn down and reconnected (0 to disable) (default 30)
-L, --local stringArray Forward local [bind_address:]port to remote host:hostport (required, repeatable)Options inherited from parent commands
--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. Overrides PW_PLATFORM_HOST environment variable and the current context's server.
-v, --verbose Enable verbose loggingSEE ALSO
- pw - The Parallel Works ACTIVATE CLI