Skip to content
AnswerWell geo Documentation

Research · 9 min read · Answerwell

Tunnel Setup, Published Application Routes and Protocol Routing

How cloudflared outbound tunnels connect private apps to public hostnames, route types, protocols, firewall rules, and verification steps.

This page summarizes Cloudflare documentation on Cloudflare Tunnel: the cloudflared daemon, remotely-managed and locally-managed tunnels, published application routes, and supported service protocols. The same tunnel pattern appears in Cloudflare One, Workers VPC, and Hyperdrive guides.

Cloudflare Tunnel and cloudflared: what they do

Section titled “Cloudflare Tunnel and cloudflared: what they do”

Cloudflare Tunnel is an outbound-only path from your network to Cloudflare. Users or edge services reach private applications through Cloudflare instead of opening inbound firewall ports on the origin.

Cloudflare Tunnel creates a secure, outbound-only connection between this machine and Cloudflare’s network. With an outbound-only model, you can prevent any direct access to this machine and lock down any externally exposed points of ingress. And with that, no open firewall ports.

— Cloudflare, Connect through Cloudflare Access using kubectl

cloudflared is the lightweight connector you install on a host that can reach your internal services (VM, Kubernetes node, or on‑prem server). Cloudflare Tunnel configuration for Workers VPC states that tunnel setup requires this daemon and distinguishes Cloudflare Zero Trust (employee access with Access and hostnames) from Workers VPC (private APIs and databases from Workers). One cloudflared instance can serve both at once.

For Workers VPC tunnels, use cloudflared 2025.7.0 or later, connect with transport auto or quic, and allow outbound UDP on port 7844. Remotely-managed tunnels via the dashboard are recommended; locally-managed tunnels use CLI-created credentials and local config.yml (ingress rules matter for public exposure, not for Workers VPC routing, which uses VPC Service configuration).

Remotely-managed vs locally-managed tunnels

Section titled “Remotely-managed vs locally-managed tunnels”
Aspect Remotely-managed (recommended) Locally-managed
Configuration storage Cloudflare (dashboard, API, Terraform) Local ~/.cloudflared and config.yml
Typical creation Networking > Tunnels or Workers VPC Tunnels tab cloudflared tunnel create <NAME> per locally-managed guide
Run command Dashboard token: sudo cloudflared service install <TUNNEL_TOKEN> (API guide) cloudflared tunnel run <UUID or NAME>
DNS for public hostnames Often created automatically when you add a published application route cloudflared tunnel route dns <UUID or NAME> <hostname>

Remotely-managed tunnels show a Healthy status in the dashboard after the connector connects (Get started).

Create a Cloudflare Tunnel: dashboard flow

Section titled “Create a Cloudflare Tunnel: dashboard flow”

Creating a tunnel means naming it, installing cloudflared on an origin that can reach your apps, and waiting until the dashboard reports an active connection.

  1. In the Cloudflare dashboard, open Networking > Tunnels (create remote tunnel).

  2. Select Create a tunnel, enter a descriptive name (for example enterprise-VPC-01), and select Create Tunnel.

  3. Choose the server OS and architecture, copy the install commands, and run them on the origin host (clientless access learning path).

  4. When the tunnel connects, select Continue and note the tunnel for routing (Workers VPC flows use the Workers VPC Tunnels tab instead of Zero Trust networking in some guides).

Log in to the Cloudflare dashboard and go to Networking > Tunnels.

— Cloudflare, Create a Cloudflare Tunnel

Place cloudflared on a machine with network path to the resources you expose—databases, APIs, or HTTP apps—and adjust cloud security groups or ACLs so the tunnel host can reach those targets (Workers VPC get started).

Automation can POST to the account tunnel endpoint with "config_src": "cloudflare" (Create a tunnel (API)). Copy the returned id and token, install cloudflared, then run sudo cloudflared service install <TUNNEL_TOKEN> (or the Windows/macOS/Docker variants on that page). Publishing an app requires a zone on Cloudflare, ingress rules including a catch-all http_status:404, and a proxied CNAME to <tunnel-id>.cfargotunnel.com.

After cloudflared tunnel login and cloudflared tunnel create <NAME>, write config.yml with tunnel, credentials-file, and ingress rules (kubectl tutorial, local management). Ingress lists must end with a catch-all rule. Run cloudflared tunnel run <NAME> as a service for production (GitLab tutorial warns that if the process stops, the app is unreachable).

Published application routes: expose a hostname without a VPN

Section titled “Published application routes: expose a hostname without a VPN”

A published application maps a public hostname users visit to a service URL where the app listens behind cloudflared.

Published application routes expose applications to the Internet via a domain that you have connected to Cloudflare. This allows users to access your applications without needing a VPN or specialized client software.

— Cloudflare, Add routes

A published application is a hostname-to-service mapping defined in your tunnel configuration. Each mapping tells cloudflared which local service should receive traffic for a given public hostname.

— Cloudflare, Routing concepts

Add a published application route in the dashboard

Section titled “Add a published application route in the dashboard”

Prerequisites: a created tunnel and a site added to Cloudflare (Add routes, create tunnel learning path).

  1. Open Networking > Tunnels, select your tunnel, then the Routes tab.

  2. Add route → Published application.

  3. Enter subdomain and domain; set Service URL (for example http://localhost:8000). See supported protocols.

  4. Save. Traffic to the hostname is proxied through Cloudflare to the tunnel.

Anyone on the Internet can now access the application at the specified hostname. To allow or block specific users, create an Access application.

— Cloudflare, Add routes

Until you add Cloudflare Access, a published HTTP app is public. Publish a self-hosted application recommends defining Access policies before or immediately after publishing.

  • Multi-level subdomains (more than one label under the zone) need an Advanced Certificate (Add routes).

  • Path on the route matches requests but does not strip or rewrite the path; the origin receives the full path. Use edge URL Rewrite Rules or a local reverse proxy to rewrite (learning path: publish an application).

  • If the origin already uses HTTPS or redirects HTTP to HTTPS, read troubleshooting for HTTPS origins before picking http:// vs https:// in Service URL (same learning path).

  • Dashboard routes create DNS pointing the hostname at <UUID>.cfargotunnel.com (Routing concepts).

Wizards for private web apps, clientless SSH, and similar flows follow the same pattern: define the internal target, pick a public subdomain, assign or create a tunnel, then deploy cloudflared on a host that can reach the app.

Protocols for published application routes

Section titled “Protocols for published application routes”

When you add a route, the service field tells cloudflared how to proxy. Non-HTTP types usually need client-side cloudflared (Protocols).

Service type Role Example service value
HTTP HTTPS at edge to local HTTP http://localhost:8000
HTTPS HTTPS to local HTTPS https://localhost:8000
TCP TCP over WebSocket; client runs cloudflared access tcp tcp://localhost:2222
SSH SSH over WebSocket; client runs cloudflared access ssh ssh://localhost:22
RDP RDP over WebSocket rdp://localhost:3389
SMB SMB over WebSocket smb://localhost:445
HTTP_STATUS Fixed response (often catch-all) http_status:404
BASTION Jump host to local addresses bastion

HTTP examples appear in AWS, GCP, and Kubernetes guides (Service set to http://localhost:80 or http://httpbin-service).

For browser-rendered SSH, add a published route with service SSH and localhost:22 or <server IP>:22, then add a self-hosted Access application (SSH in the browser). RDP published routes use service RDP and the listening port (RDP with client-side cloudflared).

For generic TCP, authenticate with cloudflared tunnel login, protect the hostname with Access, run on the server cloudflared tunnel --hostname tcp.site.com --url tcp://localhost:7870, and on the client cloudflared access tcp --hostname tcp.site.com --url localhost:9210 (Arbitrary TCP). Clients need egress on ports 80 and 443 for Access. Point the application at the local port you chose.

Private hostname and private network routes (not public publish)

Section titled “Private hostname and private network routes (not public publish)”

Private hostname routes register internal FQDNs (for example wiki.internal.local) for resolution through Cloudflare One without the full client in some setups (Connect a private hostname). Wildcard rules allow a single * per label (*.internal.local); partial or multiple wildcards are not supported.

Tunnel CIDR routes (for example RDP to a private GCP IP) appear in Connect to RDP using the Cloudflare One Client. Egress hostname routes tie a public hostname to a tunnel for egress policy scenarios (Egress through Cloudflare Tunnel).

For large private file transfer, Routing concepts note plan terms for video and large files on public hostname routes and suggest private network routes for large private transfers.

High availability, Kubernetes, and quick tunnels

Section titled “High availability, Kubernetes, and quick tunnels”

Run multiple cloudflared tunnel run <NAME> processes on different hosts to add connector IDs; check with cloudflared tunnel info <NAME> (Deploy replicas).

In Kubernetes, store the remote tunnel token in a Secret and run the official cloudflare/cloudflared image with tunnel run and a /ready liveness probe (Kubernetes deployment guide). Point the published route Service at the in-cluster DNS name (for example http://httpbin-service).

Quick Tunnels (cloudflared tunnel --url http://localhost:8080) issue a random trycloudflare.com URL for local previews without a named tunnel (Quick Tunnels, Pages preview). They differ from production remotely-managed tunnels with your own zone and Access policies.

Lock down the origin while keeping the tunnel

Section titled “Lock down the origin while keeping the tunnel”

Cloud guides recommend removing public inbound access once the tunnel works: allow only outbound to Cloudflare tunnel IPs, and verify the app still loads on the published hostname but not on the VM’s public IP (AWS, Azure, GCP). Keep SSH inbound or you lose shell access.

On Linux you can use iptables to drop ingress except loopback, established connections, and SSH, then persist rules (Tunnel with firewall).

  • Publishing without Access — Internet-wide access until you create an Access application.

  • Wrong Service URL — Use http://localhost:<port> when the app speaks plain HTTP locally even if users hit HTTPS on the public hostname (protocols).

  • Missing catch-all ingress — API/Terraform/local configs must end with http_status:404 (API publish steps, Terraform publish apps).

  • Tunnel host cannot reach the app — Security groups or NSGs must allow the cloudflared host to reach the database or API (private database example).

  • Disconnected tunnel — Allow egress 7844 (and QUIC UDP for Workers VPC); confirm the connector machine can reach internal services (learning path troubleshooting note).

  • Stopping cloudflared — The tunnel process must stay running as a service (Arbitrary TCP, GitLab tutorial).

  • Windows SMB on port 445 — Local Server service may block cloudflared access tcp; disabling it has side effects (SMB use case).

  1. In the Cloudflare dashboard, open Networking > Tunnels and confirm the connector shows Healthy or Active (as in the Terraform test step).

  2. Open the published hostname in a browser; for a test HTTP server you should see the expected page (for example Hello Cloudflare! per AWS or Ansible test).

  3. If Access is configured, confirm the login page appears for anonymous users and allowed identities pass (Terraform guide).

  4. Try the origin’s direct public IP or DNS; after firewall hardening it should not serve the app, while the tunnel hostname still works (AWS firewall section).

  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact sentence you are asking about so it can be corrected.