Cloudflare Zero Trust Guide
A glowing cable exits a locked cloud beside a server rack and wired network box, visualizing secure tunneling versus direct access.
networking

Cloudflare Tunnel vs Port Forwarding: Which to Use

Compare Cloudflare Tunnel vs port forwarding for self-hosted apps. See where TCP and UDP 7844 apply and what CGNAT, SSH and WARP mean for your setup.

By Cloudflare Zero Trust Guide Editorial · ·Updated · 7 min read

Use Cloudflare Tunnel for a self-hosted browser app behind carrier-grade NAT (CGNAT). The reverse tunnel starts at cloudflared, which connects outbound to Cloudflare on destination port 7844 over UDP for QUIC or TCP for HTTP/2. Leave inbound router forwarding disabled for the app. Cloudflare Tunnel overview and firewall guide.

Choose direct port forwarding when public clients need a native TCP or UDP socket and your Internet connection supports inbound access. The router maps incoming traffic on the chosen protocol and port to your server, and a matching firewall rule permits it. Keep the forwarded service updated and configure authentication for it. Netgate port forwarding guide.

Cloudflare Tunnel vs port forwarding at a glance

QuestionCloudflare TunnelDirect port forwarding
Who opens the origin-side connection?cloudflared connects out to CloudflareA remote client connects in through the router
Does it need a public origin IPv4 address?NoDirect IPv4 access needs a reachable public address
What does a browser user install?A standard browser is enough for a published web appA standard browser is enough for a public web service
What about native protocols?Published TCP and SSH require client-side cloudflaredCompatible clients use the forwarded TCP or UDP port
Where does browser TLS terminate?At Cloudflare, with a separate connection to the appAt your server or reverse proxy when DNS points directly to it
What authenticates users?Cloudflare Access or application authenticationApplication authentication or a separate access layer
What sets the upload limit?Cloudflare’s proxy limit and the origin’s limitThe limits of your origin and any reverse proxy on the direct path

Port 7844 and the path to a local dashboard

Suppose the dashboard and cloudflared run on the same host. Use http://localhost:8000 as the origin for the dashboard’s published hostname. Cloudflare receives HTTPS from the browser, sends the request through the existing tunnel, and cloudflared makes the local HTTP request. Published application protocols.

Dashboard request
Browser ── HTTPS ──▶ Cloudflare ── existing tunnel ──▶ cloudflared ──▶ http://localhost:8000

Tunnel connection setup
cloudflared ── outbound UDP/7844 (QUIC) or TCP/7844 (HTTP/2) ──▶ Cloudflare
Firewall pathRule for the dashboard
Connector to CloudflareAllow both UDP/7844 and TCP/7844 outbound to the documented tunnel destinations. Permit return traffic for established connections.
Internet to the originKeep direct inbound access to the dashboard blocked. Remove any old router forward for the dashboard.
Connector to the dashboardAllow local loopback traffic for this example. If you put the dashboard on another subnet, permit the connector to reach the dashboard’s service port.

For a connector on a services VLAN, apply the outbound rule on the firewall path from that VLAN to Cloudflare. Scope it to the connector and the documented tunnel destinations. Cloudflare firewall guide and Netgate guidance on rules and interfaces.

From outside your LAN, verify both paths before relying on the change.

  • Open the published HTTPS hostname in a browser. For a dashboard protected by Access, sign in as an allowed user and confirm the dashboard loads. Confirm that a user outside the policy is denied. Self-hosted application guide.
  • If the dashboard had a direct TCP path, test it from the outside network. For a former HTTPS path on TCP/443, run netcat -zv ORIGIN_IP 443. Replace ORIGIN_IP with your own origin’s public address and use the port you previously exposed. Check each public IPv4 or IPv6 address that could reach the dashboard. The direct TCP connection should fail. Tunnel firewall verification and Tunnel FAQ.

CGNAT: why a tunnel works when a port forward does not

An ISP-facing IPv4 address within 100.64.0.0/10 uses shared address space reserved for carrier-grade NAT. Under CGNAT, the ISP controls an upstream translation layer. A rule on your own router changes only the mapping on that router. RFC 6598.

Tunnel uses the connector’s outbound connection, so it works without a publicly reachable origin address. With IPv6, NAT is usually unnecessary. A public IPv6 address still needs an inbound firewall policy, so check it separately when closing a direct origin path. Cloudflare Tunnel overview and Netgate IPv6 and NAT guide.

DDNS versus no inbound exposure

Dynamic DNS (DDNS) updates a hostname as your public IP address changes. It solves the address discovery problem. Inbound reachability still depends on the firewall and any upstream NAT, and authentication still depends on the service or an access layer. Netgate Dynamic DNS guide.

With direct forwarding, use DDNS if clients need a stable hostname for a changing public address. With Tunnel, DNS points users toward Cloudflare and the published hostname routes through the connector, so the origin’s changing address stays out of client DNS. Tunnel FAQ.

A published hostname can still be reached from the internet after you close the origin port. For a private dashboard on a published hostname, create the Access application and an allow policy before publishing the route. Cloudflare’s self-hosted application guide and Zero Trust ingress guide.

Non-HTTP protocols: cloudflared access and private routing

A published TCP or SSH route carries the connection over WebSockets. The published hostname requires the client-side transport shown below. Public native UDP clients need a different route because UDP is outside the published application’s supported services. Published application protocol matrix.

Client needRoute and client
Native TCP or SSH with client-side cloudflaredFor published TCP, use cloudflared access tcp to provide a local endpoint for the native app. For published SSH, use cloudflared access ssh as the native SSH client’s proxy command.
Long-lived TCP or SSH for managed devicesUse private Client-to-Tunnel routing via Cloudflare One Client (WARP). The native client connects to the private address or hostname.
Public UDP or native clients that cannot install Cloudflare softwareUse direct forwarding if your connection supports inbound access and the protocol fits the firewall rule.

For the client commands and their arguments, see Cloudflare’s published TCP guide and published SSH guide.

WARP runs on the user’s device and carries traffic for private routes to Cloudflare. The cloudflared connector runs on your network and delivers that traffic to the service. A standard browser can open a published HTTPS dashboard without WARP. Cloudflare private routing guide and WARP vs VPN.

WebSocket and SSH connection limits

Cloudflare supports WebSockets. Edge restarts and idle timeouts can close connections, so plan for reconnects and use a heartbeat during idle periods. Cloudflare WebSocket guidance.

For long-lived TCP and SSH, Cloudflare recommends private Client-to-Tunnel routing. A directly forwarded TCP or SSH connection uses its native transport, and its availability depends on the network and application. Published application protocols.

Free-plan upload ceiling: 100 MB per request

Cloudflare lists a 100 MB maximum upload size per request on Free and Pro for proxied traffic. The zone can set a lower maximum, and the origin can have its own limit. An oversized request can receive a 413 while the tunnel is healthy. Evaluate monthly transfer and connector throughput separately. Cloudflare Error 413 reference.

Use smaller upload requests if the app supports chunking. Direct forwarding avoids Cloudflare’s proxy ceiling when the client connects directly to your origin. If the hostname stays proxied through Cloudflare, its proxy limit still applies. Cloudflare Error 413 reference.

For video or large-file delivery, check the service terms for public hostname routes and how they differ from private routes. Tunnel FAQ.

Privacy and availability trade-offs

Published HTTPS through Tunnel makes Cloudflare a trusted intermediary. Browser TLS terminates at Cloudflare even when the origin leg is encrypted. With direct HTTPS, TLS can terminate at your own reverse proxy. Cloudflare SSL/TLS concepts.

Tunnel also requires a running connector. Error 1033 means Cloudflare cannot find a healthy connector for the tunnel. Failures between the connector and its local service have their own checks. First tunnel setup guide, error 1033 checks and Cloudflare Tunnel errors.

Isolate the connector on a services VLAN

Consider placing the connector with the services it publishes. Use firewall rules between subnets to permit only the origin ports it needs, restrict administration separately and keep unrelated internal subnets inaccessible. The same segmentation can limit what a directly forwarded server can reach. Netgate guidance on rules and interfaces.

Choose from the application outward

Choose Tunnel plus Access for an internal browser dashboard that needs identity checks and outbound-only origin connectivity. Choose private client routing for managed endpoints reaching private services. Use direct forwarding when public native protocol compatibility is essential and your connection supports inbound access, such as for a game server whose players connect over UDP.

Before relying on either route, verify that intended users can connect. For restricted services, also check that unauthorized users are denied. Use the external checks above when moving a dashboard from forwarding to Tunnel. Check upload and reconnect behavior over the chosen route against the application’s requirements.

Evidence and limits. The example uses Cloudflare One’s firewall guide (October 12, 2026 revision) and published protocol matrix (April 17, 2026 revision), alongside Netgate’s current pfSense documentation and RFC 6598. The example steps were not run.

Sources

  1. Cloudflare Tunnel
  2. pfSense documentation: Port Forwarding
  3. Cloudflare One docs: Protocols for published applications
  4. RFC 6598: Shared Address Space
  5. Cloudflare One docs: Publish a self-hosted application
  6. Cloudflare SSL/TLS concepts
  7. Cloudflare One docs: Tunnels FAQ
  8. Cloudflare One docs: Tunnel with firewall
  9. Cloudflare Network docs: WebSockets
  10. Cloudflare Support: Error 413 and maximum upload size
  11. pfSense documentation: IPv6 and NAT
  12. pfSense documentation: Dynamic DNS
  13. Cloudflare One docs: Connect with cloudflared
  14. Cloudflare One docs: Common Tunnel errors
  15. pfSense documentation: Troubleshooting Firewall Rules
  16. Cloudflare One docs: Arbitrary TCP
  17. Cloudflare One docs: Connect to SSH with client-side cloudflared

Related