Documentation

localhostforonline is a single-binary CLI you can run via npx.

Install

npm
$ npm install -g localhostforonline

tunnel

Forward a local port to a public HTTPS URL.
tunnel
$ npx localhostforonline --port 3000
With a pinned subdomain:
tunnel
$ npx localhostforonline --port 3000 --subdomain my-app

login

Authenticate the CLI and store the API key locally.
auth
$ npx localhostforonline login

whoami

Show the currently authenticated user.
auth
$ npx localhostforonline whoami

Flags

  • --port <n> — local port to forward
  • --url <url> — forward to a full URL (e.g. http://localhost:8080)
  • --subdomain <name> — pin a permanent subdomain (requires login)
  • --host-header rewrite — rewrite Host header to localhost:<port>
  • --tcp — enable TCP forwarding
  • --dev — force dev mode (auto-detected for Next.js)