From 688eff2b01da96c47497f8a643c62e8a61f1bf80 Mon Sep 17 00:00:00 2001 From: Christoph Date: Fri, 21 Feb 2025 08:27:50 +0100 Subject: [PATCH] Update tailscale_container_hook - Allow changing the target address from Tailscale Serve --- share/docker/tailscale_container_hook | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/share/docker/tailscale_container_hook b/share/docker/tailscale_container_hook index 177f11653..817e22eb1 100755 --- a/share/docker/tailscale_container_hook +++ b/share/docker/tailscale_container_hook @@ -361,12 +361,15 @@ if [ ! -z "${TAILSCALE_SERVE_PORT}" ]; then if [ -z "${TAILSCALE_SERVE_PROTOCOL_PORT}" ]; then TAILSCALE_SERVE_PROTOCOL_PORT="=443" fi + if [ -z "${TAILSCALE_SERVE_TARGET}" ]; then + TAILSCALE_SERVE_TARGET="http://localhost" + fi if [ "${TAILSCALE_FUNNEL}" = "true" ]; then echo "Enabling Funnel! See https://tailscale.com/kb/1223/funnel" - eval tailscale funnel --bg --"${TAILSCALE_SERVE_PROTOCOL}"${TAILSCALE_SERVE_PROTOCOL_PORT}${TAILSCALE_SERVE_PATH} http://localhost:"${TAILSCALE_SERVE_PORT}${TAILSCALE_SERVE_LOCALPATH}" | grep -v "To disable the proxy" + eval tailscale funnel --bg --"${TAILSCALE_SERVE_PROTOCOL}"${TAILSCALE_SERVE_PROTOCOL_PORT}${TAILSCALE_SERVE_PATH} ${TAILSCALE_SERVE_TARGET}:"${TAILSCALE_SERVE_PORT}${TAILSCALE_SERVE_LOCALPATH}" | grep -v "To disable the proxy" else echo "Enabling Serve! See https://tailscale.com/kb/1312/serve" - eval tailscale serve --bg --"${TAILSCALE_SERVE_PROTOCOL}"${TAILSCALE_SERVE_PROTOCOL_PORT}${TAILSCALE_SERVE_PATH} http://localhost:"${TAILSCALE_SERVE_PORT}${TAILSCALE_SERVE_LOCALPATH}" | grep -v "To disable the proxy" + eval tailscale serve --bg --"${TAILSCALE_SERVE_PROTOCOL}"${TAILSCALE_SERVE_PROTOCOL_PORT}${TAILSCALE_SERVE_PATH} ${TAILSCALE_SERVE_TARGET}:"${TAILSCALE_SERVE_PORT}${TAILSCALE_SERVE_LOCALPATH}" | grep -v "To disable the proxy" fi if [ "${TAILSCALE_SERVE_PROTOCOL}" = "https" ]; then TS_DNSNAME="$(tailscale status --json | jq -r '.Self.DNSName' | sed 's/\.$//')"