SitePoint14 min readtutorialintermediate
Setting Up Cloudflare Tunnels with Docker Compose for Persistent Webhook Debugging
Summary
A step‑by‑step tutorial showing how to run a persistent, free Cloudflare Tunnel alongside a TypeScript/Node.js webhook consumer in Docker Compose, replacing ngrok for local webhook debugging.
- ngrok free tier is unsuitable for webhook development due to random subdomains, session timeouts, and rate limits.
- Cloudflare Tunnels (cloudflared) provide a zero‑trust, outbound‑only tunnel that persists as long as the container runs, with optional named tunnels for stable URLs.
- The article ships a full Docker‑Compose stack: a `cloudflared` service forwarding traffic to a `webhook` service built from a multi‑stage Dockerfile.
- The webhook consumer is a minimal Express app in TypeScript that validates HMAC‑SHA256 signatures using a constant‑time comparison and preserves the raw request body for accurate verification.
Local webhook testing is a common pain point; a free, containerized, persistent tunnel removes the need for manual URL updates and session restarts, speeding up integration work with services like Stripe, GitHub, or Slack.
6/10


