BLACK FRIDAY 2026 ACTIVO: RackNerd 4GB VPS $47.98/año (de por vida) · ElevenLabs 55% OFF · Hardware IA en Amazon Ver Ofertas Verificadas →
Lab Essay #04 · Networking & Edge8 min readReal Lab Measurements

Caddy 2.8 vs Nginx vs Cloudflare Tunnel for AI Webhooks: Measured TTFB, Streaming SSE & Why I Run Two Together

TL;DR

Direct Nginx or Caddy on a datacenter VPS delivers 1.5 ms origin render with zero third-party hop, while Cloudflare Tunnel (`cloudflared`, 39 MB RSS) adds ~50–150 ms edge hop overhead in exchange for zero open inbound ports and instant CGNAT bypass. For VPS-hosted n8n/OpenClaw, use Caddy 2.8 with `flush_interval -1`; for home Mac mini / N100 boxes—or hiding your origin VPS IP behind edge DDoS protection—pair local Nginx/Caddy with `cloudflared`.

Terminal screenshot from root@kvm-node-01 showing local Nginx TTFB 0.001506s vs Cloudflare Tunnel edge TTFB 0.150397s, cloudflared 40064 KB RSS, and Postgres/Redis bound strictly to 127.0.0.1
Figure 1 · Live Origin vs Cloudflare Tunnel TTFB & Loopback Port Audit: Measured directly on our live Ubuntu 24.04 KVM host (2026-11-26 UTC): local loopback origin renders in 1.5 ms while the Cloudflare Tunnel edge round-trip totals 150.4 ms (40 ms DNS + 89 ms TLS + origin hop) at just 39.1 MB RSS.

1. The Reverse-Proxy Debate Nobody Benchmarks Properly

Most self-hosting tutorials treat Caddy, Nginx, and Cloudflare Tunnel as mutually exclusive religions. In production AI stacks—where n8n receives Stripe/Telegram webhooks, OpenClaw streams token-by-token responses over Server-Sent Events (SSE), and voice agents need sub-900 ms turns—choosing the wrong proxy or forgetting one buffering flag silently breaks streaming.

On our live node (`192.227.155.161`), we measured local Nginx origin TTFB at 1.5 ms (`0.001506s`) and full HTTPS delivery through `cloudflared` at 150.4 ms (`0.150397s`) with `cloudflared` consuming 40,064 KB (39.1 MB) RSS. That ~149 ms difference is completely invisible for static web pages and async webhooks, yet noticeable if you chain three synchronous voice-agent hops across continents.

Caddy 2.8 vs Nginx vs Cloudflare Tunnel for Self-Hosted AI Stacks (2026)
Proxy LayerMeasured RSSAuto HTTPSStreaming SSE TrapBest Production Role
Caddy 2.8~32–45 MBZero-config ACMEAdd flush_interval -1Default all-in-one VPS proxy for n8n/OpenClaw
Nginx~18–26 MBNeeds Certbot/CFSet proxy_buffering offHigh-throughput static + /go/* click logging
Cloudflare Tunnel39.1 MB (measured)Edge TLS included100s HTTP timeout cap on FreeHome N100/Mac mini CGNAT bypass + zero open ports

2. The 100-Second Cloudflare Timeout Trap on Long AI Workflows

Here is the single biggest surprise engineers hit after putting n8n behind Cloudflare Tunnel or Orange-Cloud proxy: Cloudflare Free and Pro plans enforce a strict **100-second HTTP read timeout** (Error 524). If a synchronous webhook triggers a deep research AI agent or scrapes 20 URLs before replying, Cloudflare severs the connection at second 100—even though n8n keeps running in the background.

The architectural fix is never "abandon Cloudflare." It is making long-running n8n webhooks respond immediately (`202 Accepted` using the "Respond to Webhook" node) and push final results asynchronously via callback URL, Slack, or Telegram. For synchronous streaming LLM responses under 100 seconds, disable proxy buffering (`flush_interval -1` in Caddy; `proxy_buffering off;` in Nginx) so tokens flush immediately instead of stalling until completion.

3. Exact Zero-Buffering Configs for Streaming AI Agents

Whether you choose Caddy 2.8 on a $48/yr VPS or Nginx behind a home Cloudflare Tunnel, copy the exact streaming block below so SSE tokens and ElevenLabs audio chunks never buffer in proxy RAM:

# Option A: Caddy 2.8 (recommended for VPS n8n / OpenClaw)
agent.yourdomain.com {
  encode zstd gzip
  reverse_proxy n8n:5678 {
    flush_interval -1
    transport http {
      read_timeout 120s
    }
  }
}

# Option B: Nginx behind Cloudflare Tunnel (127.0.0.1 loopback only)
location / {
  proxy_pass http://127.0.0.1:5678;
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "upgrade";
  proxy_buffering off;
  proxy_cache off;
  chunked_transfer_encoding on;
}

Related Engineering Deep-Dives