Skip to content

Forward a Session's ports

Open a dev server running in a Session at the same port on localhost on your machine, so redirects, cookies and curl work as they would locally.

While something listens on a port in an Active Session, its header shows how many, such as 3 ports. Press it to see each port, the process holding it, and the kndl forward command for the Session.

The Open ports list: 3000 bun server, 5173 node vite, and 5432 docker-proxy with a Docker label, and the kndl forward command.

  1. On your machine, run:

    Terminal window
    kndl forward
  2. Pick the Session with the arrow keys, and press Enter:

    Forward which Session?
    > 0b9256 claude/fix-login owner/name 3000, 5173
    77ab12 Docs owner/name no open ports
    Up and down to choose, Enter to forward, Esc to quit
  3. The CLI lists each port it forwards:

    Forwarding 0b9256 claude/fix-login · owner/name · Active
    http://localhost:3000 bun server · 1 connection
    http://localhost:5173 node vite
    Esc: forward another Session · Ctrl-C: stop
  4. Open http://localhost:5173 in your browser.

Ports that open or close in the Session later are added and removed as they do. Esc goes back to the picker. Ctrl-C stops forwarding.

Name the Session by its id, the start of its id, or its URL:

Terminal window
kndl forward 0b9256

Forward only some ports by naming them after the Session:

Terminal window
kndl forward 0b9256 5173 3000

Forward a Session’s port to a different port on your machine with <session port>:<local port>:

Terminal window
kndl forward 0b9256 3000:3100

An app that redirects to its own address, as an OAuth sign-in does, only works on the same port.

By default, only your machine reaches the ports. To let a phone or another device on your network reach them, pass --bind:

Terminal window
kndl forward 0b9256 --bind 0.0.0.0
  • The Session shows you in Here now as forwarding from your machine.
  • The Session stays awake while a forward is connected.
  • Forwarding an Asleep Session you started wakes it. Anyone else’s forward of it is told it’s Asleep, and that only its Creator can wake it.
  • If the connection to the Hub drops, the CLI reconnects on its own.

If a port is already taken on your machine, the CLI says which process holds it and keeps retrying. See Commands for every option.

kndl is an independent project. It is not affiliated with or endorsed by Anthropic. Claude and Claude Code are trademarks of Anthropic, PBC. About kndl