--- title: Preview the docs site from a Zed remote session description: Forward the Astro docs dev server (port 4321) over SSH so you can open it in your local browser while editing this repo through Zed remote development. --- By the end of this tutorial you will open the docs site in your local browser while its dev server runs on the remote host — with the repo edited through Zed remote development over SSH. The docs dev server binds to `127.0.0.1:4321` on the remote host, so `localhost:4321` on your laptop reaches nothing until SSH forwards the port. Zed does this for you once you add a `port_forwards` entry to your **local** Zed settings. You need about five minutes and a working Zed remote connection to the `rssbase` host. ## Before you start Make sure you already connect to the remote from Zed using the SSH host alias `rssbase` (defined in your `~/.ssh/config`). The forward is keyed on that exact host name. ## Step 1 — Add the port forward Open your local Zed settings (`~/.config/zed/settings.json` on Linux, command palette → `zed: open settings`) and add an `ssh_connections` entry: ```json "ssh_connections": [ { "host": "rssbase", "port_forwards": [ { "local_port": 4321, "remote_port": 4321 } ] } ] ``` Zed turns this into an `ssh -L 4321:localhost:4321` tunnel. `remote_host` is omitted, so it defaults to `localhost` on the remote — which matches where Astro listens. ## Step 2 — Restart Zed Port forwards are read at connection time and do not hot reload. Quit Zed completely and reopen it, then reopen the `rssbase` remote project. ## Step 3 — Start the docs server on the remote In the remote project's terminal, run: ```bash docs ``` This runs `pnpm dev` for the Starlight site and serves it on `http://127.0.0.1:4321` on the remote host. ## Step 4 — Open it locally On your laptop, visit: ``` http://localhost:4321 ``` You should see the RSSBase Docs site. Your browser hits local port 4321, SSH forwards it to the remote, and Astro answers. ## What you did - Added a `port_forwards` entry to your local Zed settings for the `rssbase` host. - Restarted Zed so the SSH tunnel came up. - Started the docs dev server on the remote. - Loaded the live site in your local browser. ## Where to go next - Edits under `docs/` hot reload in the same browser tab. - If remote file saves or extension uploads start failing, a known Zed bug passes the `-L` flag to `scp` too ([zed#36454](https://github.com/zed-industries/zed/issues/36454)); remove the `port_forwards` entry when you are not previewing the site.