mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-01 00:42:49 +08:00
TRUST_PROXY=1 trusted CF-Connecting-IP and the first X-Forwarded-For entry, both of which a client can send itself when the proxy in front isn't Cloudflare (nginx's $proxy_add_x_forwarded_for only appends), so per-IP limits could be sidestepped. Now TRUST_PROXY=1 takes the last X-Forwarded-For entry (the one the proxy appended), and the new TRUST_PROXY=cloudflare takes only CF-Connecting-IP. The bundled compose file (cloudflared) switches to cloudflare. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
41 lines
1.7 KiB
YAML
41 lines
1.7 KiB
YAML
services:
|
|
webspeak3:
|
|
build: .
|
|
image: moepchi/webspeak3:latest
|
|
container_name: webspeak3
|
|
restart: unless-stopped
|
|
environment:
|
|
- PORT=8080
|
|
# This file publishes no port - the gateway is only reachable through
|
|
# the cloudflared tunnel below, so the client IP it forwards can be
|
|
# trusted (per-IP limits would otherwise see every user as the tunnel).
|
|
# Remove this if you publish a port directly instead; behind your own
|
|
# reverse proxy use TRUST_PROXY=1.
|
|
- TRUST_PROXY=cloudflare
|
|
# Nothing in here needs Linux capabilities (unprivileged port, plain
|
|
# TCP/UDP sockets), so drop them all.
|
|
cap_drop: [ALL]
|
|
security_opt: [no-new-privileges:true]
|
|
# Port publishing is deployment-specific and left out of this file on
|
|
# purpose - Compose concatenates `ports:` lists across an override file
|
|
# instead of replacing them, so adding one here would double-publish
|
|
# instead of letting an override change it. Set it in a local, gitignored
|
|
# docker-compose.override.yml:
|
|
#
|
|
# services:
|
|
# webspeak3:
|
|
# ports:
|
|
# - "8080:8080"
|
|
|
|
cloudflared:
|
|
image: cloudflare/cloudflared:latest
|
|
container_name: webspeak3-cloudflared
|
|
restart: unless-stopped
|
|
command: tunnel --no-autoupdate run --token ${CLOUDFLARE_TUNNEL_TOKEN}
|
|
# Token comes from a gitignored .env file next to this compose file:
|
|
# CLOUDFLARE_TUNNEL_TOKEN=eyJ...
|
|
# No depends_on/network wiring needed - the tunnel's Public Hostname
|
|
# config (set in the Cloudflare dashboard) points at the webspeak3
|
|
# service by its Compose service name (http://webspeak3:8080), and
|
|
# Compose puts both services on the same default network automatically.
|