On this pageWhy localhost is unreachable
Your app runs on localhost:3000 and someone else needs to see it: a client wants a demo, a payment provider needs to call your webhook, or you want to check the layout on your phone. Every solution to this problem works around the same two obstacles, so it pays to understand them first. Then the options sort themselves into three groups: no tunnel at all, a tunnel through someone else's edge, or a relay you own.
Why localhost is unreachable
The bind address. Most development servers listen on 127.0.0.1, the loopback interface. Only programs on the same machine can connect to it, by design.
The network edge. Even when the app listens on every interface, your laptop sits behind a router doing network address translation. Outsiders see one shared public address, and the router has no idea which device should receive an unsolicited connection. Many internet providers add carrier-grade NAT on top, so there may be no public IPv4 address of yours to forward at all. Firewalls on the laptop and the router drop what is left.
Outbound connections, on the other hand, work everywhere. That is the trick behind every tunnel: your machine dials out to a server with a public address, keeps the connection open, and the server sends incoming requests back through it.
No tunnel needed: same network or a private mesh
When the other device is on the same Wi-Fi, only the bind address is in the way. Tell the dev server to listen on all interfaces:
python3 -m http.server 8000 --bind 0.0.0.0
npx vite --host
npx next dev -H 0.0.0.0
Find your machine's LAN address with ip -4 addr on Linux or ipconfig on Windows, and open something like http://192.168.1.20:5173 on the other device. Your operating system's firewall may ask to allow the connection. Every device on that network can now reach the app, which is fine at home and less fine on café Wi-Fi.
When the audience is teammates in other places, a mesh VPN such as Tailscale, or plain WireGuard, extends the same idea across the internet. Each machine gets a private address that only members of your network can reach. Run the dev server on that address and share the private URL; nothing becomes public, and no third party handles the traffic in the clear.
Borrow someone else's edge: quick tunnels
A tunnel client makes an outbound connection to a provider that hands you a public URL. Nothing has to be opened on your router:
cloudflared tunnel --url http://localhost:3000
ngrok http 3000
tailscale funnel 3000
- Cloudflare Quick Tunnels need no account and print a random
trycloudflare.comaddress. Cloudflare positions them for testing and development: there is no uptime guarantee, each tunnel handles up to 200 in-flight requests, and Server-Sent Events are not supported. - ngrok requires an account and offers reserved domains plus request inspection and replay, which is handy for debugging webhooks.
- Tailscale Funnel publishes a local port at an address on your tailnet's
ts.netdomain. It can only listen on ports 443, 8443 and 10000, needs MagicDNS and HTTPS enabled, and must be allowed in the tailnet policy.
Editors such as VS Code can also forward a port through their own tunnel service for a quick look. These are the fastest options by far, and the address belongs to the provider: it changes, or it carries their domain, and the provider's limits apply.
Build your own edge: a relay server
For a stable URL on your own domain, put a small server with a public address in the middle. The laptop opens an SSH reverse tunnel to it, and a reverse proxy on the server serves your domain with HTTPS. The server's address never changes, so the URL does not either.
From your machine, forward the relay's port 8080 to your local app:
ssh -N -o ServerAliveInterval=30 -o ExitOnForwardFailure=yes \
-R 8080:127.0.0.1:3000 deploy@relay.example.com
By default, SSH binds the forwarded port to the relay's loopback interface only, which is exactly what you want: the internet cannot reach port 8080 directly, only through the proxy. On the relay, install Caddy and give it a site block, here with a password in front:
demo.example.com {
basic_auth {
client $2a$14$replace.with.output.of.caddy.hash-password
}
reverse_proxy 127.0.0.1:8080
}
Generate the hash with caddy hash-password, reload Caddy with sudo systemctl reload caddy, and point the domain's DNS record at the relay. Caddy obtains the certificate on its own once ports 80 and 443 are reachable. Caddy releases older than 2.8, which some distributions still package, spell the directive basicauth.
Keep the tunnel up
A dropped Wi-Fi connection kills a plain SSH session. A user-level systemd unit on your Linux machine reconnects automatically; save it as ~/.config/systemd/user/relay-tunnel.service:
[Unit]
Description=Reverse tunnel to the relay
[Service]
ExecStart=/usr/bin/ssh -N -o ServerAliveInterval=30 -o ExitOnForwardFailure=yes -R 8080:127.0.0.1:3000 deploy@relay.example.com
Restart=always
RestartSec=5
[Install]
WantedBy=default.target
systemctl --user daemon-reload
systemctl --user enable --now relay-tunnel
User services stop when you log out; run loginctl enable-linger once if the tunnel should survive that.
Use a dedicated key for the tunnel and lock it down on the relay. In the relay account's authorized_keys, prefix that key with restrict,port-forwarding,permitlisten="8080",command="/bin/false": it may then open exactly one remote forward on port 8080, and any attempt to run a shell or command simply exits. For several services, UDP traffic or many clients, tools built for the job, such as frp or a WireGuard link plus the same reverse proxy, scale better than individual SSH tunnels.
The relay itself needs very little CPU or memory, and every CloudSat server comes with its own IPv4 and IPv6 addresses, so the smallest Cloud VPS works well as one.
The options compared
| Option | Who can reach it | Address | Lasts | Setup |
|---|---|---|---|---|
| Bind to the LAN | Devices on the same network | Your LAN IP | While the app runs | Seconds |
| Mesh VPN | Members of your private network | A private address | As long as you like | Minutes |
| Quick tunnel | Anyone with the link | The provider's domain | Minutes to hours | One command |
| Your own relay | Anyone, or only those with the password | Your own domain | Permanent | About fifteen minutes |
Rules for anything you expose
- Assume the link leaks. Anyone who has a public URL can use it, so put a login, a token or basic authentication in front of anything not meant for strangers.
- Never expose admin tools. Database ports, admin panels and debug consoles stay local, whatever the tunnel.
- Use demo data. A demo database without real customer records turns a leaked link into a non-event.
- Close it when you are done. Stop quick tunnels after the meeting, and disable relay sites you no longer need.
FAQ
Why do webhooks need a public URL?
The sending service, such as a payment provider or a Git host, makes an HTTP request from its own servers. It cannot reach localhost on your machine, so it needs an address on the internet that leads back to you.
When should I stop tunneling?
When real users depend on the app. A laptop sleeps, changes networks and runs everything else you do. Package the app in a container, deploy it to a server (see the Docker Engine install guide or the self-hosted PaaS guide), and keep tunnels for the next feature branch.
Could I skip all this with IPv6?
Sometimes. If your provider gives your machine a global IPv6 address and your router allows inbound connections, other IPv6 devices can reach it directly. Many home and office networks block inbound traffic, and many visitors still lack IPv6, so it is not a reliable way to share with others.
Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.




