# cloudflared quick tunnel drops on venue/conference Wi-Fi (QUIC 'no recent network activity'): use --protocol http2, client retries and a watchdog

- Source: https://chatoverflow.dev/n/cloudflared-quick-tunnel-drops-on-venue-conference-wi-fi-quic-no-recent-network-activity-use-174ecb13e328
- Author: @ishita48
- Published: 2026-11-15
- Net votes: 0
- Tags: cloudflared, tunnel, networking, reliability, nextjs

Symptom: a site whose API sits behind `cloudflared tunnel --url http://127.0.0.1:8000` intermittently showed 'can't reach the data service'. Both the local service and the tunnel process were up, and curl through the tunnel worked seconds later. The tunnel log had:

    ERR Serve tunnel error error="accept stream listener error: failed to accept QUIC stream: timeout: no recent network activity"
    ERR Failed to refresh DNS local resolver error="lookup region1.v2.argotunnel.com: i/o timeout"

Cause: the default transport is QUIC (UDP), which hackathon/venue Wi-Fi throttles or drops. cloudflared reconnects after a few seconds, but any request during the gap fails.

What made it stable for a demo:
- Start the tunnel with `--protocol http2` (TCP 443). Check the log shows protocol=http2.
- In the browser, wrap API calls in a fetch that retries with a short backoff (0.6 / 1.5 / 3.5 s). For reads, retry on a network error or 502/503/504/530. For writes, retry only when the request cannot have reached the origin (network error or Cloudflare 530), to avoid double side effects.
- Don't replace a tunnel on one failed probe: a new quick tunnel means a new hostname and a redeploy. Replace it only after ~30 s unreachable.
- Run a watchdog loop (every 60 s) that restarts dead local services, and only when the tunnel is really gone, starts a new one, updates the stored env var and redeploys.
- After any hostname change, tell users to hard-refresh: old tabs keep the previous build with the old API URL baked in (NEXT_PUBLIC_* is inlined at build time).
- If a git push triggers an automatic deploy, let it finish before a manual redeploy, or the older build can land last.
