fix(tailscale): Use localhost and network_mode for Funnel/Serve
Some checks failed
/ validate-docker-compose (push) Has been cancelled

Tailscale Funnel/Serve requires proxying to localhost or 127.0.0.1.
This commit updates the target URL to http://localhost:80 and sets
Traefik's network_mode to service:tailscale to allow tailscale to
correctly forward traffic to the traefik container.
This commit is contained in:
Jose Daniel G. Percy 2025-04-25 11:09:40 +08:00
parent cc51dd386c
commit 8051ea33e3

View File

@ -13,9 +13,10 @@ services:
- --experimental.plugins.rewrite-body.version=v1.2.0 - --experimental.plugins.rewrite-body.version=v1.2.0
- --experimental.plugins.rewriteHeaders.modulename=github.com/XciD/traefik-plugin-rewrite-headers - --experimental.plugins.rewriteHeaders.modulename=github.com/XciD/traefik-plugin-rewrite-headers
- --experimental.plugins.rewriteHeaders.version=v0.0.3 - --experimental.plugins.rewriteHeaders.version=v0.0.3
ports: network_mode: service:tailscale # Add this line
- "80:80" # ports: # Remove this section
- "443:443" # - "80:80"
# - "443:443"
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro - /var/run/docker.sock:/var/run/docker.sock:ro
extra_hosts: extra_hosts:
@ -539,12 +540,12 @@ services:
# --- Start Tailscale Funnel/Serve --- # --- Start Tailscale Funnel/Serve ---
# Check the ENABLE_FUNNEL_HTTPS variable # Check the ENABLE_FUNNEL_HTTPS variable
if [ "${ENABLE_FUNNEL_HTTPS}" = "true" ]; then if [ "${ENABLE_FUNNEL_HTTPS}" = "true" ]; then
echo "ENABLE_FUNNEL_HTTPS is true. Setting up Funnel -> http://traefik:80..." echo "ENABLE_FUNNEL_HTTPS is true. Setting up Funnel -> http://localhost:80..."
tailscale funnel --bg http://traefik:80 tailscale funnel --bg http://localhost:80
echo "Tailscale Funnel configured." echo "Tailscale Funnel configured."
else else
echo "ENABLE_FUNNEL_HTTPS is false. Setting up Serve -> http://traefik:80..." echo "ENABLE_FUNNEL_HTTPS is false. Setting up Serve -> http://localhost:80..."
tailscale serve --bg http://traefik:80 tailscale serve --bg http://localhost:80
echo "Tailscale Serve configured." echo "Tailscale Serve configured."
fi fi
# --- End Tailscale Funnel/Serve --- # --- End Tailscale Funnel/Serve ---