Skip to content

Commit a5a0cda

Browse files
committed
Fix tailscale serve: use localhost:PORT, helpful error on Linux
Tailscale serve only supports localhost or 127.0.0.1 as proxy targets. On Linux, prompts user to run `sudo tailscale set --operator=$USER` if access denied.
1 parent a755ecd commit a5a0cda

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

bin/dev

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ if [ "$USE_TAILSCALE" = "1" ]; then
3535
stop_tailscale() { tailscale serve --https=$TS_PORT off >/dev/null 2>&1; }
3636
trap stop_tailscale EXIT INT TERM
3737

38-
sudo tailscale serve --bg --https=$TS_PORT "http://fizzy.localhost:$PORT" >/dev/null 2>&1
38+
tailscale serve --bg --https=$TS_PORT localhost:$PORT >/dev/null 2>&1
39+
if ! tailscale serve status --json 2>/dev/null | jq -e ".TCP.\"$TS_PORT\"" >/dev/null 2>&1; then
40+
echo "Error: tailscale serve failed. On Linux, run once: sudo tailscale set --operator=\$USER" >&2
41+
exit 1
42+
fi
3943
echo "Login with david@example.com to: https://$TS_HOSTNAME:$TS_PORT/"
4044
else
4145
echo "Login with david@example.com to: http://fizzy.localhost:$PORT/"

0 commit comments

Comments
 (0)