SSH local port forwarding on iPhone, iPad and Mac
The AnyPane equivalent of ssh -L. Reach a dev server,
database or admin UI on a remote host from an app on your device.
How a local forward works
Your device listens on a local port. Each connection to that port is
carried through SSH to the server, which connects on to the target
address and port. The target is resolved on the SSH server, so
127.0.0.1 means the server itself, and a private address
like 10.0.0.5 means a machine the server can reach.
From ssh -L to AnyPane
ssh -L [bind:]port:host:hostport user@server, or
LocalForward in ~/.ssh/config, maps to the
forward editor like this:
user@server- SSH Connection: the saved connection the forward goes through.
bind-
Bind Address under On This Device:
127.0.0.1or::1. port- Local Port. Leave it blank to have one assigned.
hostandhostport- Address and Port under Remote Service.
Example: a web app on the server
A web app listens on 127.0.0.1:3000 on your server. In
OpenSSH that’s ssh -L 8080:127.0.0.1:3000 user@server.
In AnyPane:
- Open Local Forwards and add a forward.
- SSH connection: your server.
-
Bind:
127.0.0.1, local port8080. Leave the port blank to have one assigned. - Target:
127.0.0.1, port3000. -
Turn it on, then open
http://127.0.0.1:8080(or the assigned port).
Example: a database behind the server
A PostgreSQL server at 10.0.0.5:5432 is only reachable
from your SSH server. Set the target to 10.0.0.5, port
5432, and the local port to 15432. A database
client on the same device then connects to
127.0.0.1:15432. The hop from the SSH server to
10.0.0.5 isn’t covered by SSH encryption.
Behavior
-
Binds are limited to
127.0.0.1or::1. Nothing on your LAN can connect. - The target address is resolved on the SSH server.
- Forwards are saved turned off and don’t start on relaunch. They are independent of workspaces and panes.
- Listening only means the local socket is up, not that the target is healthy.
- If the SSH connection uses a jump host, the forward goes through it too.
Troubleshooting
- Local port in use
- Pick another port, or leave it blank to have one assigned.
- Listening, but the page or client fails
-
Check that the target is up on that port and reachable from the SSH
server, for example with
curl -I http://127.0.0.1:3000in an SSH session. sshd must allowAllowTcpForwarding, and noPermitOpenrule may block the target. - A web app redirects to the wrong address
- Some apps redirect to the host name they were configured with. Open the forwarded port with the same local port the app expects, or change the app’s base URL.
- The forward stops when you switch apps
- On iPhone and iPad, switching to the browser can background AnyPane and suspend the forward. On iPad, keep AnyPane on screen next to the browser with Split View or Stage Manager.
Limits
Only local forwarding is available.
SOCKS proxies are not supported (no -D), and neither is
remote forwarding (-R).
FAQ
- Why can’t other devices on my network use the forward?
-
Binds are loopback-only by design, like OpenSSH without
GatewayPorts. Only apps on the same device can connect. - Do I need a terminal pane open?
- No. Forwards run on their own; turn them on and off from Local Forwards.
- Can I forward to a host other than the SSH server?
- Yes. Set the target to any address the SSH server can reach, as in the database example.
Related
Get AnyPane
For iPhone, iPad and Mac.