SSD Nodes Learn Hosting plans →
Guides Matt ConnorBy Matt Connor

Is Cloudflare Tunnel secure? What it misses

Cloudflare Tunnel closes inbound ports, but TLS ends at Cloudflare's edge and a public hostname has no login. See what it protects and what you must fix.

Is Cloudflare Tunnel secure? The short answer

Cloudflare Tunnel is secure against one real threat: attacks on open inbound ports. Your server makes only outbound connections to Cloudflare, so you can close every inbound port. It is not end-to-end encryption, though. TLS (transport layer security) from the visitor ends at Cloudflare's edge, so Cloudflare handles each request unencrypted before it forwards it to you. The tunnel also adds no login of its own. A public hostname is open to the whole internet until you put authentication in front of it.

So the honest answer is "secure for some jobs". This guide lists what the tunnel protects against, what it leaves to you, and the checks that show whether your own setup has these gaps. It is an evaluation, not an install guide. For the setup steps, read how to expose a self-hosted app with Cloudflare Tunnel and no open ports.

Every Cloudflare quote below comes from developers.cloudflare.com or Cloudflare's legal pages, checked on 12 November 2026.

What Cloudflare Tunnel protects against

The tunnel's main job is to remove the open port. The connector, a small program called cloudflared, runs next to your app and makes the connection outward. Cloudflare's overview page puts it this way: "cloudflared initiates an outbound connection through your firewall". The same page tells you what to do next: "You can then configure your firewall to allow only these outbound connections and block all inbound traffic".

That second sentence matters. The tunnel does not close your ports for you. It makes closing them possible. When you do close them, the overview page says your origins "can serve traffic through Cloudflare without being vulnerable to attacks that bypass Cloudflare". The origin is the server that runs your app.

The connection is also built to survive single failures. Each cloudflared instance opens four long-lived connections, and the availability docs say: "These four connections are made to four different servers spread across at least two distinct data centers." You can run extra copies of cloudflared (replicas) for the same tunnel. Each replica adds four more connections, so one host can fail and the others keep serving.

The leg between cloudflared and Cloudflare also uses modern cryptography. The post-quantum docs say: "Cloudflare Tunnel uses post-quantum key agreement on the TLS connection between cloudflared and Cloudflare's network." The key agreement is X25519MLKEM768. A later section covers what that does and does not protect.

Where is your traffic decrypted?

A request through a tunnel crosses two separate encrypted connections, not one. The first runs from the visitor's browser to Cloudflare's edge. The second runs from Cloudflare, through the tunnel, to cloudflared on your server. Cloudflare's edge certificate docs describe the first leg only: "These certificates secure the encrypted connection between your visitors and Cloudflare."

Between those two legs, the request is inside Cloudflare's network without TLS. That is the point where Cloudflare's own rules run on your traffic. It is also why "end-to-end encrypted" is the wrong phrase for a tunnel. The ends of the visitor's TLS session are the browser and Cloudflare, not the browser and your server.

Cloudflare's contract says the same thing in legal language. Section 2.5.5 of the Self-Serve Subscription Agreement (last updated 12 September 2025) reads: "Cloudflare may monitor and inspect the traffic on the Cloudflare network". The clause ties this to performing the services and protecting the network's security. Section 2.5.3 adds: "Cloudflare may modify certain components of Customer Content on or transmitted to or from your Internet Properties". The Privacy Policy (effective 4 November 2025) states that "Cloudflare is a data processor for any of the content provided by Customers and End Users".

None of this says Cloudflare reads your data for its own purposes. It says the terms permit inspection for running the service, and the design makes it possible. If your threat model includes the proxy provider, or a law that can compel the proxy provider, Cloudflare Tunnel does not meet it. Health records and password vault traffic are two examples where you may want TLS to end on hardware you control.

Is the last hop from cloudflared to your app encrypted?

It depends on the service URL you give the tunnel. With http://localhost:8080, the hop from cloudflared to your app is plain HTTP. That is fine when both run on the same machine, because the traffic never leaves the loopback interface. It is a real gap when cloudflared runs on one host and the app runs on another host across a network, because anyone on that network path can read it.

When the service URL is https://, cloudflared checks the origin's certificate by default. The origin parameters docs list noTLSVerify with a default of false, and say: "When false, TLS verification is performed on the certificate presented by your origin." Setting it to true means "TLS verification is disabled. This will allow any certificate from the origin to be accepted."

A common shortcut is to set noTLSVerify: true to silence a self-signed certificate error. That trades the error for an unchecked hop. The better fix is to tell cloudflared which certificate authority (CA) to trust. caPool takes a file path, and the docs say to use it "when a private CA signs the certificate and the CA is not in the default trust pool". originServerName sets the hostname cloudflared expects in the certificate. A locally managed tunnel's config.yml would look like this, as an example to adapt:

ingress:
  - hostname: app.example.com
    service: https://10.0.0.20:8443
    originRequest:
      originServerName: app.internal.example.com
      caPool: /etc/cloudflared/internal-ca.pem
  - service: http_status:404

The last line is the catch-all. The configuration file docs say a file with ingress rules "must always include a catch-all rule that concludes the file". If you need a private CA for the origin, creating a self-signed certificate on Ubuntu covers the certificate side, and adding your own CA to the Ubuntu trust store covers trusting it system-wide.

Why the tunnel token is a password

A remotely managed tunnel, the kind you create in the dashboard, runs from a single token. The permissions page is direct: "A remotely-managed tunnel only requires the tunnel token to run." And: "Anyone with access to the token will be able to run the tunnel."

Think through what that means. The docs do not spell out the attack, so this part is our reading. A person with your token can start their own cloudflared with it. Their connector joins your tunnel like a replica. The availability docs say replicas "do not support traffic steering", so you cannot assume their connector gets no share of the requests for your hostnames. Those requests would then reach a machine you do not control.

Treat the token like a root password. Keep it out of any docker-compose.yml that you commit to git, and out of shell history. Cloudflare's own advice: "Cloudflare recommends rotating the tunnel token at a regular cadence to reduce the risk of token compromise." A locally managed tunnel uses a credentials file instead of a token, and its config names that file's path. Protect that file the same way. If you already keep secrets in a vault, a self-hosted secrets manager is a better home for the token than a plain .env file.

Can someone still reach your server directly?

Yes, if you leave the ports open. A tunnel does not change what your server listens on. Cloudflare's Authenticated Origin Pulls page warns about the general case: "anyone who discovers your origin server's IP address can send requests directly, bypassing Cloudflare". Your origin IP can leak through an old DNS record from before you moved to the tunnel, or simply through a scan of your provider's address range.

When a request skips Cloudflare, it also skips every Cloudflare protection you set up, including Access login and WAF (web application firewall) rules. The tunnel only helps if the port is actually closed.

Check what your server listens on. Run this on the server:

sudo ss -tlnp

Look at the local address column. 127.0.0.1:8080 or [::1]:8080 means only the machine itself can connect. 0.0.0.0:443 or [::]:443 means the socket accepts connections on every interface, so only a firewall stands between it and the internet.

Then test from a different machine, such as your laptop. Replace 203.0.113.10 with your server's public IP:

curl -v --connect-timeout 5 http://203.0.113.10/
curl -vk --connect-timeout 5 https://203.0.113.10/

A healthy result is a failure. curl should exit with error 7 (could not connect) or error 28 (timed out). If you get an HTTP response, the origin is reachable without Cloudflare.

Docker needs extra care. Docker's packet filtering docs say that when you publish a container port, "Packets are routed before the firewall rules can be applied, effectively ignoring your firewall configuration." A "8080:80" entry under ports: in Compose can expose the app even with ufw set to deny. Publish to loopback with "127.0.0.1:8080:80", or skip publishing and put cloudflared on the same Docker network as the app. Check your provider's network firewall too, since it is a separate control from the one on the server.

The tunnel is transport, not authentication

After you add a public hostname, Cloudflare's own setup guide says: "Anyone on the Internet can now access the application at the specified hostname." The tunnel moves traffic. It does not decide who may send it. You must choose what does, and there are two main options.

Option 1: Cloudflare Access. The docs describe Access as "an authentication layer between the end user and your origin server." You create an Access application for the hostname and add at least one Allow policy. Visitors then log in through an IdP (identity provider) before any request reaches your app. Access is part of Cloudflare Zero Trust. Check the Zero Trust plans page for the current free seat limit before you plan around it.

There is one step people skip. The self-hosted app docs say: "To secure your origin, you must validate the application token issued by Cloudflare Access." Access sends that token, a JWT (JSON Web Token), with each request. cloudflared can check it for you. The origin parameters docs describe the access setting ("Protect with Access" in the dashboard) as one that "Requires cloudflared to validate the Cloudflare Access JWT prior to proxying traffic to your origin." As an example to adapt, under originRequest:

access:
  required: true
  teamName: your-team-name
  audTag:
    - your-access-application-aud-tag

Option 2: the app's own login. Most mature self-hosted apps have their own accounts and two-factor login. If you rely on those, the tunnel only hides the port, and your security is the app's security. Keep the app patched. You can also add a login proxy you run yourself: putting OAuth2 Proxy in front of an app works behind a tunnel, and Authelia versus Authentik compares two common self-hosted SSO (single sign-on) servers.

You can stack both. Access in front, with the app's login behind it, means an attacker must beat two different systems.

Why do mobile apps break behind Cloudflare Access?

Access expects a browser. When a request carries no valid session or service token, Access asks for an identity provider login. A browser shows that login page. A native mobile or desktop client that talks to your app's API usually cannot. It gets a login page where it expected API data, and it often reports a vague connection or sync error. The docs do not list which apps break, so test your own clients before you lock the hostname.

The documented ways around this all have costs:

  • Service tokens. The service token docs say: "Automated systems or applications can then use these values to reach an application protected by Access." The client sends CF-Access-Client-Id and CF-Access-Client-Secret headers, and the application needs a Service Auth policy. The tokens expire on the schedule you pick at creation. Many consumer apps have no setting for custom headers, and a long-lived token stored on a phone is a secret you cannot easily take back from one device.
  • The cloudflared client on the device. The non-HTTP docs say users "can log in to the application by installing cloudflared on their device and running a hostname-specific command in their terminal." That suits SSH and admin tools, not a phone.
  • The Cloudflare One Client. Users "can connect by installing the Cloudflare One Client on their device and enrolling in your Zero Trust organization." This works on more devices, but every user now runs a Cloudflare agent.
  • A Bypass policy. This removes Access for the matching traffic. The policy docs warn: "Bypass does not enforce any Access security controls and requests are not logged." After that, the app's own login is the only guard.

If most of your users reach the app through a native client, the app's own login (or a private network, covered below) is often the more practical design.

Does Cloudflare become a single point of failure?

Yes. Your four connections and your replicas protect against one server or one data center failing. They do not give you a path that avoids Cloudflare. If Cloudflare's network has a problem, or your account is suspended, your app is unreachable from outside, however healthy your server is. The docs do not discuss a full network outage, so this follows from the design, not from a quote.

The contract confirms the account side. Section 2.6 of the Self-Serve Subscription Agreement covers free services, and says: "We will have no liability for any harm or damage arising out of or in connection with any Free Services." The same section lets Cloudflare end free services at its sole discretion. Section 8 lets Cloudflare suspend or terminate accounts at its sole discretion. None of the Cloudflare pages checked for this guide gives an uptime commitment for free use of Tunnel.

There is also a quieter failure. cloudflared needs outbound access to Cloudflare on port 7844, over UDP for QUIC or TCP for HTTP/2, according to the firewall docs. If you lock down outbound traffic on the server and forget this port, the tunnel stops connecting. For a site that must stay up when Cloudflare does not, keep a second path, such as a reverse tunnel through your own VPS.

Can you stream video through Cloudflare Tunnel?

Cloudflare's developer docs give a clear answer here, but older Cloudflare material reads differently. Read both.

Cloudflare's Service-Specific Terms (last updated 28 September 2026) say that, unless you are an Enterprise customer, Cloudflare offers specific paid services "that you must use in order to serve video and other large files via the CDN". CDN means content delivery network. That page does not mention Tunnel.

The developer docs page on delivering video is the one that links the two. It says: "Cloudflare Tunnel public hostname routes proxy traffic through Cloudflare." And: "On Free, Pro, and Business plans, this traffic is subject to the terms described on this page." It also says: "The restriction does not apply to private network routes." When the page describes enforcement, it talks about a site that "appears to be serving videos or a disproportionate amount of large files without using the appropriate paid service".

A 2023 Cloudflare blog post on the terms change says: "We want to be clear that this restriction only applies to use of our CDN." Some people read that as permission to stream through a tunnel. The current developer docs treat a tunnel's public hostname as proxied traffic under the same rule. So do not build a Jellyfin or Plex setup on a free tunnel hostname and assume it is allowed. Use a private network route for your own devices, a paid Cloudflare video product, or a path that does not go through Cloudflare's proxy.

What does cloudflared log on your server?

The logging docs say: "By default, cloudflared writes logs to standard error (stderr) and does not store logs on the server." The default log level is info. When cloudflared runs as a systemd service, stderr normally goes to the journal, so the journal keeps whatever cloudflared prints.

Be careful with debug logging. At debug level, the run parameters docs say cloudflared will "log and display the request URL, method, protocol, content length, as well as all request and response headers". The same page warns that "this can expose sensitive information in your logs." Headers include cookies and authorization tokens. Turn debug on to solve a problem, then turn it off, and remember that the journal still holds what was printed.

The Cloudflare pages checked for this guide do not say what Cloudflare itself logs about requests that pass through a tunnel. If that matters for compliance, ask Cloudflare and get the answer in writing.

What does post-quantum encryption cover?

Post-quantum (PQ) cryptography is designed to resist attacks from future quantum computers. For Tunnel, the PQ docs say the key agreement between cloudflared and Cloudflare is post-quantum, and add: "Post-quantum signatures are not yet used for authentication on that path."

The other legs are separate. Whether the visitor's connection to Cloudflare uses PQ depends on the visitor's browser. PQ on a connection to an origin depends on "the origin servers also supporting PQC". So PQ protects the tunnel leg. It does not change the fact that Cloudflare sees the request in between.

cloudflared has a --post-quantum flag. The run parameters docs say that with it, "quic connections are only allowed to use PQ key agreements, with no fallback to non-PQ." The flag does not work with the HTTP/2 transport. The default protocol value is auto, which uses QUIC (a UDP-based transport) and falls back to HTTP/2 if UDP fails.

Cloudflare Tunnel vs Tailscale Funnel vs a plain VPN

The key difference is where TLS ends.

Tailscale Funnel also publishes a local service without an open port, but its relays do not decrypt. The Funnel docs say: "Funnel relay servers do not decrypt the traffic between public devices and your device." TLS ends on your own device, and public DNS returns a relay's address, so your device's IP stays hidden. The limits are real. Funnel is in beta. It "can only listen on ports 443, 8443, and 10000." It can only use names under your tailnet's ts.net domain, and "Traffic sent over a Funnel is subject to non-configurable bandwidth limits." The docs say it is available on all plans. Tailscale Serve versus Funnel explains when to share privately and when to go public, and whether Tailscale is secure covers what Tailscale's coordination server can and cannot see.

A plain VPN puts no proxy in the request path at all. Users join your private network first, then reach the app directly. TLS ends wherever you choose, normally on your own reverse proxy. The cost is that every user needs a VPN client, so it suits a team or a family, not the public.

A reverse tunnel through your own VPS sits between the two. A small VPS with a public IP holds the open port, and a tunnel from your home server connects to it. You run Caddy as the reverse proxy on the VPS, so TLS ends on a machine you rent and control. This is the usual answer when you are behind CGNAT (carrier-grade network address translation) and want no third-party proxy.

When is Cloudflare Tunnel the right tool?

Use it when these points hold:

  • The app is public, or you are happy to put Cloudflare Access in front of it.
  • You accept that Cloudflare handles your traffic unencrypted inside its network.
  • Users reach the app through a browser, not a native client that cannot handle a login page.
  • You do not need to serve video or large files through a free tunnel hostname.

Pick Tailscale Funnel or your own VPS when TLS must end on your hardware. Pick a plain VPN when only known people need access, because a service with no public hostname is the smallest target.

A security checklist for an existing tunnel

  1. Run sudo ss -tlnp on the server and confirm the app listens on loopback, or that a firewall blocks the port.
  2. From another machine, curl the origin IP on ports 80 and 443 and confirm the connection fails.
  3. Check Docker published ports, which skip ufw rules.
  4. Confirm every public hostname has an Access application or a strong app login.
  5. If you use Access, turn on JWT validation in cloudflared with the access setting.
  6. Remove noTLSVerify: true and use caPool for a private CA.
  7. Store the tunnel token as a secret and rotate it.
  8. Keep cloudflared at the info log level outside of debugging.

Once the origin is locked down, checking your server for known CVEs covers the next layer: the software that the tunnel now exposes.

FAQ

Is Cloudflare Tunnel end-to-end encrypted?

No. The visitor's TLS connection ends at Cloudflare's edge, and a second encrypted connection runs from Cloudflare to cloudflared on your server. In between, the request is inside Cloudflare's network without TLS, and section 2.5.5 of Cloudflare's Self-Serve Subscription Agreement says "Cloudflare may monitor and inspect the traffic on the Cloudflare network". If TLS must end on your own hardware, Tailscale Funnel or a reverse proxy on your own VPS does that.

Does Cloudflare Tunnel hide my server's IP address?

It hides the IP from visitors who use your hostname, because they connect to Cloudflare, not to you. It does not stop someone who already knows the IP from connecting directly. Close inbound ports 80 and 443 in the server firewall and in your provider's firewall, check Docker published ports, then confirm with curl from another machine that the connection fails.

Do I need Cloudflare Access if my app already has a login?

Not always. Without Access, a public hostname on a tunnel is open to anyone, and your app's own login is the only protection, so keep the app patched and turn on two-factor login. Access adds a second layer before requests reach the app. If you use it, also turn on JWT validation in cloudflared, because Cloudflare's docs say you must validate the Access token at the origin.

What happens if someone steals my tunnel token?

Cloudflare's docs say anyone with the token can run the tunnel. Our reading is that a stranger could start a connector that joins your tunnel and receive some of your traffic. Rotate the token as soon as you suspect a leak, following Cloudflare's tunnel permissions docs, and keep it out of git repositories and shared Compose files.

Can I use Cloudflare Tunnel for Jellyfin or Plex?

Cloudflare's developer docs say tunnel public hostname routes are proxied traffic, and on Free, Pro and Business plans they fall under the rules for video and large files. Those rules require a paid Cloudflare service to serve video. Private network routes are exempt, so streaming to your own devices over a private route is allowed, but a free public hostname for a media server puts your account at risk.

Was this article useful?