Gateway websocket drops in bursts behind the Cloudflare proxy (orange cloud)

(#4943) Bug Open: Needs triage infra self-hosting

Reproduction steps

  1. Self-host Fluxer behind the Cloudflare proxy (orange cloud, not a Tunnel). Gateway on the default wss://<instance>/gateway.
  2. Keep a client connected for a few hours, or hold a few gateway connections open with a script that logs every drop and the CF-RAY colo.
  3. In the same window, hold a connection that goes straight to the origin (a DNS-only hostname pointed at the same server).
  4. Compare the two. The Cloudflare connections drop in bursts; the direct one doesn't.

Expected behaviour

The gateway connection stays up, like it does when it skips Cloudflare.

Actual behaviour

Members get random "reconnecting" banners, and voice sometimes resumes mid-call (LiveKit signaling goes through the same proxy). My probe logged over 1,000 Cloudflare drops in about two days, in bursts: sometimes every couple of minutes for hours, mostly in the afternoon and evening (US time). The direct connection dropped 0 times outside of server restarts, through the same Traefik and Caddy. Drops are silent: no close frame, the client only notices on its next heartbeat. I ran the probe from home and from the server itself, and both dropped at the same moments, so it's not anyone's ISP. During bursts the reconnects land on Cloudflare colos all over the world (Paris, Tokyo, Sao Paulo...), not just the nearby ones. My guess is that Cloudflare moves long-lived connections around under load. I can't prove that from my side.

Platform

Self-hosting

Evidence

Instance version: 2026.1118.162713 (rexctl). Setup: Cloudflare proxy → Traefik → Caddy edge. What fixed it: a second, DNS-only hostname just for realtime traffic.
  • FLUXER_GATEWAY_ENDPOINT=wss://rt.<instance host>/gateway
  • FLUXER_LIVEKIT_URL=https://rt.<instance host>/livekit
  • FLUXER_CSP_EXTRA_CONNECT_SRC with both https:// and wss:// for that host
  • The voice server endpoint in the admin panel. FLUXER_LIVEKIT_URL didn't update it, because my voice server isn't in the default region.
Since the switch, the Cloudflare probes have kept dropping (178 in one ~21h stretch) and the direct ones have only dropped on restarts. Two gotchas worth putting in the self-hosting docs:
  1. The Android app only accepts a gateway host that equals the instance host or is a subdomain of it. Anything else fails login with "Couldn't read the instance's configuration" (isGatewayTrustedForApi).
  2. Existing desktop clients keep the old gateway until they sign out and back in (filing that separately).
Suggestion: a note in the self-hosting docs that if you run behind the Cloudflare proxy, you should put the gateway (and ideally LiveKit signaling) on a DNS-only subdomain.

Comments

Sign in with Fluxer to comment and vote.

No comments yet.