brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: add --bg to tailscale serve so it survives a reboot

Network and access
~/tips/tip-tailscale-serve-bg

tailscale serve --bg localhost:3000

Shares a local web app with your tailnet over HTTPS and keeps it running after a reboot.

I used to think tailscale serve was a one-off. One flag makes it stick.

tailscale serve shares a local port with the other devices on your tailnet over HTTPS. Certificates are handled for you. By default the command stays in the foreground, so closing the terminal, rebooting, or running tailscale down and up ends the share.

Add --bg and it runs in the background and comes back by itself after a reboot, until you turn it off.

tailscale serve --bg localhost:3000

Anyone on your tailnet (who the policy allows) can now open the https address of that machine and reach whatever listens on port 3000 locally. Check what is shared with tailscale serve status.

One caveat from the docs: serving a file or directory needs root, so use sudo for that. Forwarding a port does not. Also, only http://127.0.0.1 is supported as a reverse proxy target, so the app has to listen on localhost.

My take: this is the nicest way I know to try a web app on a phone without opening anything on the router. It needs no port forwarding, dynamic DNS or certificate setup. If you later decide you want it public after all, that is a separate step with funnel, and you have to choose it on purpose.

Further reading: tailscale serve, On this site: clear every Serve and Funnel setting with tailscale serve reset, On this site: tailscale ping tells you if a device is reached directly or through a relay, On this site: Why a Tailscale device vanishes after 180 days, and how to stop it

More Network and access tips scp -3 alice@server-a:/var/backups/db.sql.gz bob@server-b:/srv/restore/ tailscale exit-node suggest tailscale lock sign nodekey:1abddef1 tlpub:abcdef12 wg genpsk > peer1.psk Table = off All Network and access tips (163) All topics

Link