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.run domain.
  • bindport — 80 or 443.
    • 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 localhost to IPv6 [::1] while frameworks listen on 127.0.0.1. Try 127.0.0.1 if 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

CommandResult
ssh -R 80:localhost:8080 localhost.runFree domain → localhost:8080
ssh -R 80:localhost:3000 localhost.runFree domain → localhost:3000
ssh -R example.com:80:localhost:3000 localhost.runexample.com → localhost:3000
ssh -R www.example.com:80:localhost:3000 -R example.com:80:localhost:3000 localhost.runexample.com and www → localhost:3000
ssh -R admin.example.com:80:localhost:8000 -R example.com:80:localhost:3000 localhost.runadmin → :8000, apex → :3000
ssh -R example.com:80:localhost:3000 localhost.run -- --no-inject-http-proxy-headersNo HTTP proxy headers
ssh -R example.com:80:localhost:3000 localhost.run -- --inject-proxy-protocol-headerProxy Protocol v1 header per connection