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.
This commit is contained in:
@@ -35,7 +35,11 @@ if [ "$USE_TAILSCALE" = "1" ]; then
|
||||
stop_tailscale() { tailscale serve --https=$TS_PORT off >/dev/null 2>&1; }
|
||||
trap stop_tailscale EXIT INT TERM
|
||||
|
||||
sudo tailscale serve --bg --https=$TS_PORT "http://fizzy.localhost:$PORT" >/dev/null 2>&1
|
||||
tailscale serve --bg --https=$TS_PORT localhost:$PORT >/dev/null 2>&1
|
||||
if ! tailscale serve status --json 2>/dev/null | jq -e ".TCP.\"$TS_PORT\"" >/dev/null 2>&1; then
|
||||
echo "Error: tailscale serve failed. On Linux, run once: sudo tailscale set --operator=\$USER" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Login with david@example.com to: https://$TS_HOSTNAME:$TS_PORT/"
|
||||
else
|
||||
echo "Login with david@example.com to: http://fizzy.localhost:$PORT/"
|
||||
|
||||
Reference in New Issue
Block a user