Open a localhost app running on a remote server
Your coding agent says the app runs on localhost:3000 on a server. Open it from your laptop or phone: SSH forwarding, Tailscale Serve, Funnel or a tunnel.
When a coding agent on a remote server says “the app is running on http://localhost:3000”, that address means the server itself, not your laptop. From a laptop, forward the port over SSH and open http://localhost:3000 locally: ssh -N -L 3000:localhost:3000 you@server. From a phone, or without an SSH session, run tailscale serve 3000 on the server and open the https://….ts.net address it prints on any device in your tailnet. Only when someone off your network, or a webhook, has to reach it, use Tailscale Funnel or a Cloudflare quick tunnel, both of which put the app on the public internet.
Which route, by who has to reach it
- SSH port forwarding: only the computer holding the SSH session. Nothing new listens on the server. On a phone it needs an SSH app that forwards ports.
- Tailscale Serve: your devices signed in to your tailnet, laptop and phone alike, over HTTPS, subject to your tailnet’s access rules.
- Binding to the private address: the same devices as Serve, over plain HTTP to the server’s Tailscale IP, with no Tailscale feature to enable.
- Tailscale Funnel: anyone on the internet who has the address.
- Cloudflare quick tunnel: anyone with a random
trycloudflare.comaddress, unless you add an email check.
SSH: forward the port to your laptop
Run this on your laptop, not on the server:
ssh -N -L 3000:localhost:3000 you@serverCopiedIn OpenSSH’s manual, -L listens on the first port on your machine and, for each connection, opens one “from the remote machine” to the host and port after it. So the localhost in the middle is resolved on the server, which is exactly the address the agent reported. -N runs no remote command: “useful for just forwarding ports.” Leave it running and open http://localhost:3000 in your browser. If port 3000 is taken on your laptop, change the first number: -L 8080:localhost:3000 and open port 8080.
The server’s app sees a request for localhost, as it would on your own machine, so dev servers that refuse unknown host names (below) raise nothing on this route. If you are already in VS Code’s Remote - SSH, you may not need the command: its release notes describe it finding ports to forward automatically, in an SSH session by watching terminal output for them, and its SSH docs add “Forward a Port” in the Command Palette for the rest. Either way it lists them in the Ports view.
Tailscale Serve: one address for laptop and phone
With the server and your devices on the same tailnet (setting one up for an agent’s machine, and keeping the server from reaching back into your devices, is the Tailscale SSH guide), run on the server:
tailscale serve 3000CopiedTailscale’s Serve documentation shows what it prints when it works:
Available within your tailnet:
https://amelie-workstation.pango-lin.ts.net
|-- / proxy http://127.0.0.1:3000
Press Ctrl+C to exit.CopiedThat address, with your server’s name and your tailnet’s, opens the app over HTTPS from any device signed in to the tailnet, including the Tailscale app on a phone. Forwarding a port does not need root. A few things to know:
- It runs in the foreground. Ctrl+C or closing the session ends it.
tailscale serve --bg 3000keeps it running in the background;tailscale serve statusshows what is served andtailscale serve resetclears it all. The CLI reference warns that without--bg, after a reboot or a Tailscale restart “you must restart Serve manually.” - The app must be on the server itself. “Only http://127.0.0.1 is supported for proxies,” in the CLI reference’s words, which is where an app reported as
localhostalready is. - Your access rules still apply. A device the tailnet policy keeps away from the server can’t open the address either.
“Serve is not enabled on your tailnet”
Serve needs HTTPS certificates turned on for the tailnet. When the tailnet isn’t set up for it, the command doesn’t fail outright: in Tailscale’s source it prints the text and link that Tailscale’s coordination server returns, then waits. The wording reported in July 2026 was:
Serve is not enabled on your tailnet. To enable, visit: https://login.tailscale.com/f/serve?node=…
Follow the link and turn the feature on for the tailnet. The waiting command notices, prints “Success.” and carries on, so there is nothing to rerun.
Binding to 0.0.0.0, on a private network only
The other way is to make the dev server listen beyond the server’s loopback and open it by the Tailscale IP. Vite listens on localhost by default, and its docs say --host 0.0.0.0 or --host makes it “listen on all addresses, including LAN and public addresses.” That last word is the problem: on a server with a public IP and no firewall in front of it, every address includes the public one, and a dev server, with its debug pages and an agent’s half-finished work, is then on the internet. Give the private address instead:
npx vite --host $(tailscale ip -4)Copiedand open http://100.x.y.z:5173, the IP that tailscale ip -4 printed, from a device in the tailnet. Next.js is the opposite case: its next dev and next start listen on 0.0.0.0 by default, so an app an agent started with npm run dev on a server whose ports are open is already reachable on the public IP, whatever the agent printed. next dev -H $(tailscale ip -4) holds it to the tailnet. Checking open ports on Linux shows how to read which address each process listens on.
When the dev server refuses the name
Opening a dev server by a name other than localhost, which is what a ts.net or trycloudflare.com address does, can meet a refusal from the dev server itself rather than from the network. Vite’s reads, in its source:
Blocked request. This host ("my-server.tailnet-name.ts.net") is not allowed. To allow this host, add "my-server.tailnet-name.ts.net" to `server.allowedHosts` in vite.config.js.
The host in quotes is the name Vite was asked for. Vite allows localhost, names under .localhost and any IP address by default, which is why the SSH route and the Tailscale IP pass and a name does not. Add the name to server.allowedHosts, or the whole tailnet with a leading dot:
// vite.config.js
export default {
server: {
allowedHosts: [".tailnet-name.ts.net"],
},
};CopiedSetting it to true allows every name, and Vite’s docs say that “allows any website to send requests to your dev server through DNS rebinding attacks.” Next.js has the same kind of guard for its development assets: it allows localhost and the name it was started with, and, in its docs’ words, “Any other hostname needs an entry, such as a tunnel used for remote development,” in allowedDevOrigins in next.config.js.
Public routes: Tailscale Funnel and Cloudflare’s quick tunnel
A webhook is the case the private routes cannot serve: Stripe, GitHub or a chat platform calling the app comes from the internet, not from your tailnet or your SSH session. So does showing the app to someone who isn’t on your tailnet. Both of these put the app where anyone with the address can reach it, so they suit a dev server only as long as you need them. Tailscale against Cloudflare Tunnel compares the two for a service you keep.
Tailscale Funnel
tailscale funnel 3000CopiedThe same ts.net address as Serve, but, in Tailscale’s words, “for anyone to access—even if they don’t use Tailscale.” Funnel listens only on ports 443, 8443 and 10000, has bandwidth limits you cannot change, and needs MagicDNS, HTTPS and a funnel node attribute in the tailnet policy file. The public DNS record can take up to 10 minutes to appear the first time. tailscale funnel reset takes it down.
Like Serve, the command first asks Tailscale for a link to turn the feature on. Where that route isn’t available, it falls back to a check whose messages are, in Tailscale’s source:
Funnel not available; "funnel" node attribute not set. See https://tailscale.com/s/no-funnel.
Funnel not available; HTTPS must be enabled. See https://tailscale.com/s/https.
The first means the policy file gives this device no funnel attribute; add a nodeAttrs entry granting it in the tailnet policy file. The second means the tailnet’s HTTPS certificates are off.
Cloudflare’s quick tunnel
cloudflared tunnel --url http://localhost:3000CopiedCloudflare’s quick tunnel needs no Cloudflare account or domain: it prints a temporary trycloudflare.com address, and “Anyone with the URL can access your local service.” Adding --allowed-mail you@example.com puts an email one-time code in front of it, which a browser can pass and a webhook cannot. As of November 2026 Cloudflare lists the limits: no uptime guarantee, 200 requests in flight before it answers 429, no Server-Sent Events, testing and development only, and a new address every time it starts. That last one matters for a webhook, whose registered address goes stale whenever the tunnel restarts, while Funnel’s address is the device’s own ts.net name.