CLI Reference
localhost.run uses SSH, already installed on all major operating systems (usually OpenSSH — see the man page).
text
ssh -R tunnel localhost.run [-- [--output output] [--[no-]inject-http-proxy-headers] [--inject-proxy-protocol-header] [--proxy-protocol-header-version version]]-R [customdomain:]bindport:host:hostport
Forward connections from your localhost.run domain to host:hostport.
- customdomain — optional custom domain. Omit it for a free
localhost.rundomain. - bindport —
80or443.80: unencrypted forwarder on 80 plus a TLS-decrypting forwarder on 443. Your app receives plain traffic.443: HTTPS redirect on 80 plus TLS passthru on 443. Your app receives unaltered TLS. Advanced — for developing TLS apps such as Let's Encrypt handlers. If unsure, use 80.
- host:hostport — the local address of your app, e.g.
localhost:8080.
Note: some systems resolve
localhostto IPv6[::1]while frameworks listen on127.0.0.1. Try127.0.0.1if you have connection issues.
--output output
Event message format: text (default) or json.
--inject-http-proxy-headers
HTTP proxy headers are on by default; disable with --no-inject-http-proxy-headers. See proxy headers.
--inject-proxy-protocol-header
Send a Proxy Protocol header at the start of each TCP connection.
--proxy-protocol-header-version version
v1 (default) or v2.
Examples
| Command | Result |
|---|---|
ssh -R 80:localhost:8080 localhost.run | Free domain → localhost:8080 |
ssh -R 80:localhost:3000 localhost.run | Free domain → localhost:3000 |
ssh -R example.com:80:localhost:3000 localhost.run | example.com → localhost:3000 |
ssh -R www.example.com:80:localhost:3000 -R example.com:80:localhost:3000 localhost.run | example.com and www → localhost:3000 |
ssh -R admin.example.com:80:localhost:8000 -R example.com:80:localhost:3000 localhost.run | admin → :8000, apex → :3000 |
ssh -R example.com:80:localhost:3000 localhost.run -- --no-inject-http-proxy-headers | No HTTP proxy headers |
ssh -R example.com:80:localhost:3000 localhost.run -- --inject-proxy-protocol-header | Proxy Protocol v1 header per connection |