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

tunnels

List tunnels from every workspace where you are an active member. Each row identifies its workspace.
tunnels
$ npx localhostforonline tunnels
Use JSON output for scripts and integrations:
tunnels
$ npx localhostforonline tunnels --json

subdomains

List subdomains from every workspace where you are an active member. Each row identifies its workspace.
subdomains
$ npx localhostforonline subdomains
Use JSON output for scripts and integrations:
subdomains
$ npx localhostforonline subdomains --json
Configure password protection:
subdomains
$ npx localhostforonline subdomains auth my-app
npx localhostforonline subdomains auth my-app --user visitor --password secret
npx localhostforonline subdomains auth my-app --off

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 Vite and Next.js)
  • --keep-origin — forward Origin/Referer/Sec-Fetch-* untouched, even in dev mode
  • tunnels --json — list every accessible tunnel as JSON, including its workspace
  • subdomains --json — list every accessible subdomain as JSON, including its workspace
  • subdomains auth <name> --off — configure or disable password protection