You have a service running on a box behind your ISP's router. Maybe it's a self-hosted dashboard, a Nextcloud instance, a Grafana board. You want to reach it from a café in another city. The usual answer is port forwarding plus a dynamic DNS name, and the usual problem is that your ISP put you behind CGNAT, so there is no public IP to forward anything to. The modern reflex is cloudflared tunnel run: an outbound-only QUIC connection that punches through NAT and CGNAT and makes the service reachable at a hostname you own. It works. It also hides a specific set of trade-offs that only show up later — when a dashboard stops updating every 100 seconds, or a 300 MB upload dies at 40 percent.
This is a breakdown of the mechanism first, then the bill, then the failure modes, and finally a checklist for deciding whether you need a real VPS with a public IP instead.
What is actually inside the daemon
cloudflared is not a port-forwarder. It is a reverse-proxy client that opens outbound connections to Cloudflare's edge over QUIC (HTTP/3), and keeps them open. Each edge connection is a multiplexed stream channel: your server dials out, the edge accepts, and requests arriving at your public hostname are pushed back down those existing streams. Nothing listens on your WAN interface. That is why it survives CGNAT — the connection is outbound, so the NAT table maps it like any browser tab.
Three pieces make it work:
- The tunnel — a named, persistent object in your Cloudflare account holding credentials and routing rules.
- The DNS record — a CNAME at your hostname pointing at
<tunnel-id>.cfargotunnel.com, which is proxied (orange cloud) by default. - The ingress config — a YAML file mapping hostnames to local ports, evaluated top-down, with a catch-all
service: http_status:404at the bottom.
A minimal config looks like this:
tunnel: <uuid>
credentials-file: /etc/cloudflared/<uuid>.json
ingress:
- hostname: app.example.com
service: http://localhost:3000
- service: http_status:404
If you forget the catch-all, the daemon refuses to start with a validation error. That is one of the few places it fails loudly.
Zero Trust Access: the policy layer you get for free, and the one you pay for
When you attach an Access application to app.example.com, the edge checks identity before the request ever reaches your tunnel. Your origin sees nothing from unauthenticated clients — not the request, not the TCP handshake, not the IP. That is genuinely stronger than a self-signed basic-auth prompt on the origin, because the attack surface is the edge, not your home router.
But this also means you lose the client IP. Inside the application, X-Forwarded-For will typically carry a Cloudflare edge address, not the visitor's. If your app does IP allowlisting, rate-limits per client, or logs geolocation, you need to read CF-Connecting-IP instead — and if the app is behind another proxy locally, that header chain has to be configured deliberately or it breaks silently.
Where the free tier bites: the 100-second idle rule
Here is the failure that generates the most forum threads. A dashboard using Server-Sent Events (SSE) or a long-polling endpoint sits idle for a couple of minutes, then the browser quietly reconnects and the page stops updating. The cause is the 100-second idle timeout on Cloudflare's proxied connections: if no bytes flow in either direction for that long, the edge closes the stream.
WebSockets hit the same wall. Many applications open a socket and then send nothing until the user clicks something. The connection is killed, the client library reconnects, and the user sees a spinner that resolves — or, worse, a stale UI that never resolves. The symptom is deceptive: it looks like an application bug, not a network one.
The fix is a keepalive. Either:
- configure the application to send a ping frame every 30–60 seconds (most WebSocket libraries support this natively), or
- put a proxy in front that does it for you.
// client-side keepalive, plain WebSocket
setInterval(() => {
if (ws.readyState === WebSocket.OPEN) ws.send(JSON.stringify({ type: "ping" }));
}, 45000);
The upload cap nobody reads about
On the free plan, requests through the proxied tunnel are subject to a 100 MB body limit. Large file uploads — backups, video, ISO images — will fail with a 413 from the edge, not from your app. The error often surfaces as a generic "upload failed" in the browser, so people spend an afternoon debugging the origin before checking the edge.
If you need to move big files, the honest answer is not to tunnel them. Use a direct path (WireGuard to a VPS, or a storage bucket with presigned URLs) and keep the tunnel for the interactive surface.
What you give up in latency and visibility
Every request takes an extra hop: client → nearest Cloudflare edge → tunnel → your origin. In practice this adds tens of milliseconds in the same region, and more when the edge and your origin are far apart. For an admin panel, irrelevant. For a latency-sensitive API or a game backend, it is a real cost.
Visibility is the subtler loss. Your origin's logs see edge IPs. Your firewall sees nothing. Your packet captures on the LAN show the QUIC stream, not the HTTP inside it. Troubleshooting becomes "ask Cloudflare's dashboard", which is fine until it isn't.
| Concern | Tunnel | VPS with public IP |
|---|---|---|
| Works behind CGNAT | Yes | No (needs the VPS itself) |
| Client IP visible to origin | Only via CF-Connecting-IP |
Yes, natively |
| Long-lived WebSockets | Needs keepalive | Fine |
| Large uploads | 100 MB cap (free) | Your disk, your rules |
| Latency | One extra hop | Direct |
| Attack surface | Edge, not your router | Your VPS firewall |
The decision checklist
A tunnel is enough when all of these hold:
- The service is interactive and human-driven (dashboards, wikis, admin panels, internal tools).
- You can add keepalives to any long-lived connection, or the app has none.
- Uploads stay under the free-tier cap, or you route large files elsewhere.
- You do not need per-client IP logic in the app.
- Latency of tens of milliseconds is acceptable.
You still need a real VPS with a public IP when any of these hold:
- You run game servers, media streaming, or anything with sustained bidirectional traffic.
- You need raw TCP/UDP (not just HTTP), e.g. a mail server on port 25 or a custom protocol.
- You must see real client IPs and control the full network path.
- You are moving hundreds of megabytes per request routinely.
The pattern that works for most home labs is hybrid: the tunnel for the admin surface you want behind Access, and a VPS or a direct VPN for the heavy traffic. Trying to force everything through one path is where the 100-second timeouts and 413s start to feel like a broken setup rather than a deliberate trade-off. More on the topic: “VPN Anonymity Myth and Information Security Law: What Your VPN Really Hides About Your IP Address, DNS Leaks and Logs”.
If your self-hosted stack includes an LLM endpoint or a RAG service, the same latency and upload limits apply — worth sizing before you commit.