> Documentation index: https://docs.kiste.run/llms.txt, a list of every page in this documentation.

# Port forwarding

> Forward a local port to a port inside a Kiste, in the foreground or in the background.

```bash
kiste forward 8080 3000                 # localhost:8080 -> port 3000 in the current Kiste
kiste forward build 3000                # localhost:3000 -> port 3000 in build
kiste forward build 3000 8080:80        # several ports at once
kiste forward --name build --remote 3000 --local 8080
```

A forward listens on your computer's loopback address and carries each
connection to the port inside the Kiste, over the same SSH connection as
`kiste ssh`. Nothing is published: only programs on your own computer can use
it. It runs until you press Ctrl-C.

## In the background

```bash
kiste forward build 3000 --background   # returns once the listener is up
kiste forward build 3000 --stop         # ends it
```

Background forwards run inside your computer's shared connection to the Kiste.
They end with `--stop`, with `kiste logout`, or when the Kiste stops.

## Port forwarding or Kiste Stream?

|  | `kiste forward` | `kiste stream` |
| --- | --- | --- |
| Who can reach it | Only your computer | Anyone with the address |
| Address | `localhost:PORT` | `https://<long-random-name>.kiste.stream` |
| Protocols | Any TCP | HTTP and WebSocket |
| Needs the CLI running | Yes | No |

To share a web app with someone, or open it on your phone, use
[Kiste Stream](https://docs.kiste.run/stream.md).

## Related topics

- [Overview](https://docs.kiste.run/ssh.md)
- [Copy files](https://docs.kiste.run/ssh/files.md)
- [SSH configuration and editors](https://docs.kiste.run/ssh/ssh-config.md)
- [Device keys](https://docs.kiste.run/ssh/devices.md)
- [Run commands](https://docs.kiste.run/ssh/commands.md)
- [Coding agents and credentials](https://docs.kiste.run/ssh/agents.md)
- [Browser terminal](https://docs.kiste.run/ssh/browser-terminal.md)
- Previous: [Copy files](https://docs.kiste.run/ssh/files.md)
- Next: [SSH configuration and editors](https://docs.kiste.run/ssh/ssh-config.md)
