From fbe8d47cc6da7145b0bea5ab59f14e177309ccce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Han=C3=9F?= Date: Tue, 1 Sep 2026 16:12:34 +0200 Subject: [PATCH] fix(proxy): stop advertising HTTP/3 and enable Caddy access logs Caddy enables HTTP/3 by default and adds `Alt-Svc: h3=":443"; ma=2592000` to every response, but the stack never made QUIC reachable: a compose port mapping written as "443:443" publishes TCP only, so UDP 443 was never forwarded to the container. The advertisement was therefore always false, regardless of how the host firewall is configured. Clients that act on it cache the alternative for up to 30 days and prefer HTTP/3 on subsequent navigations. With nothing listening, the QUIC handshake hangs until it times out and the browser shows a blank page. Reloading does not help, because the cached entry survives it; only clearing site data or disabling HTTP/3 in the browser restores access. The failure leaves no trace server-side, since no connection is ever established. Verified on a running deployment: responses carried the Alt-Svc header over HTTP/2 while a QUIC handshake to the same host timed out after 10s with no reply, and controls against public HTTP/3 endpoints completed in under 0.1s. Chromium forced onto QUIC for the origin failed with ERR_QUIC_PROTOCOL_ERROR; the same binary without the flag loaded the app normally. Disabling HTTP/3 rather than publishing 443/udp: browsers do not run the WebSocket API over HTTP/3, so the actor traffic that carries a live quiz stays on TCP either way and HTTP/3 would only affect the initial bundle load. The alternative would require the port publish and the operator's firewall to agree on every deployment, and this stack is shipped to self-hosters whose firewalls we do not control, leaving the advertisement in place would hand each of them the same latent outage. Also enables the site access log. Client IPs are filtered out: the diagnostic value is whether a request arrived at all, and that needs no personal data. Output goes to stderr, so `docker compose logs caddy` picks it up; the caddy service gains the same 20m/10-file json-file cap the backend and database already use. --- docker/Caddyfile | 21 +++++++++++++++++++++ docker/docker-compose.prod.yaml | 7 ++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/docker/Caddyfile b/docker/Caddyfile index 8bf85f0..bf99417 100644 --- a/docker/Caddyfile +++ b/docker/Caddyfile @@ -1,6 +1,27 @@ +{ + # The compose port mapping publishes 443/tcp only, so QUIC never reaches + # the container. Without this, Caddy would still advertise h3 via Alt-Svc + # and clients that act on it hang for up to 30 days. + servers { + protocols h1 h2 + } +} + {$DOMAIN} { encode gzip + # Access log without client IPs — the diagnostic value here is whether a + # request arrived at all, which needs no personal data. + log { + format filter { + wrap json + fields { + request>remote_ip delete + request>client_ip delete + } + } + } + handle_path /api/* { reverse_proxy backend:3123 } diff --git a/docker/docker-compose.prod.yaml b/docker/docker-compose.prod.yaml index b9e0c2d..3cbae3c 100644 --- a/docker/docker-compose.prod.yaml +++ b/docker/docker-compose.prod.yaml @@ -4,6 +4,11 @@ services: caddy: image: caddy:2-alpine restart: unless-stopped + logging: + driver: "json-file" + options: + max-size: "20m" + max-file: "10" ports: - "80:80" - "443:443" @@ -70,4 +75,4 @@ networks: default: driver: bridge driver_opts: - com.docker.network.driver.mtu: "1450" # adjust to your indrastructure + com.docker.network.driver.mtu: "1450" # adjust to your infrastructure