Cloudflare Zero Trust Guide
Flat isometric illustration of a pink balance arm on a hexagonal base, ringed by raised tiles bearing glowing padlocks and one crossed-out circle icon.
zero-trust

Cloudflare Zero Trust Tunnel and Access Instead of a VPN

Replace VPN ingress for one internal web app with Cloudflare Tunnel and Access. Choose a route, validate access tokens, and verify the cutover.

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

To replace broad VPN ingress for one internal web app, publish its hostname through Cloudflare Tunnel and put a per-app Cloudflare Access policy in front of it. Create the policy before publishing, turn on connector-side token validation, and verify that approved users get in and other users are denied before closing the old inbound path.

Outbound tunnels remove inbound ingress

A zero trust tunnel needs no inbound Internet ports open at the origin. The internal cloudflared connector opens an outbound connection to Cloudflare and forwards permitted requests to the app over the network it can already reach. As you close the old rule, keep the connector’s access to the app and its outbound access to Cloudflare. With token validation enabled, the connector also needs outbound HTTPS access to your Cloudflare Access team domain. Cloudflare’s Tunnel firewall guide

To set up a connector, follow Cloudflare Tunnel setup for your first tunnel. For CGNAT and how an outbound tunnel changes origin exposure, see Cloudflare Tunnel vs port forwarding.

Access, Gateway and Tunnel: where each product starts and stops

Tunnel connects Cloudflare to the service. Access authorizes users for a configured app. Gateway network policies govern traffic routed through Gateway, including connections from enrolled devices to private IPs.

RouteChoose it whenWhat controls access
Published hostnameUsers need to open one web app in a standard browser without first joining the private network.Access checks identity and app policy at the public hostname. Tunnel carries allowed traffic to the origin.
Private IP or CIDRThe service should stay on a private address, or clients need native access to a private protocol.An enrolled Cloudflare One Client routes traffic to the private IP. Gateway network policy can restrict destinations by user identity and device posture.

The private route can be reachable by enrolled devices by default. Use Cloudflare’s private IP routing guide to send the destination through Split Tunnels and configure Gateway network policy. See the published app guide and private network overview for the two routing models.

Move one web app off VPN ingress

Start with one app, an active domain on Cloudflare, a running remotely managed tunnel, and a configured identity provider (IdP). Record the hostname the users will visit, the service URL the connector can reach, and the old inbound rule and destination. Cloudflare’s identity-gated edge guide

  1. Create the Allow policy. In Zero Trust > Access controls > Policies, select Add a policy. Name it, choose Allow, set the session duration, and add an Include rule for the approved IdP group. Select Save. Cloudflare lists Identity provider group for supported providers, SAML Group for generic SAML and OIDC Claim for generic OIDC. Manage Access policies and Access policy selectors
  2. Create the Access app before publishing. Go to Zero Trust > Access controls > Applications and select Create new application, then Self-hosted and private. Select Add public hostname and configure the app’s hostname. Add the Allow policy under Access policies, select the approved IdP, and select Create. Access denies users who match no Allow policy. Self-hosted public application
  3. Map the hostname to the service. Go to Networking > Tunnels, select the tunnel, and open Routes. Choose Add route > Published application. Enter the same hostname as in Access and set Service URL to the address the connector can reach. If the connector and app share a host, an example mapping is app.example.com to http://127.0.0.1:8080. Tunnel dashboard setup and Identity-gated edge guide
  4. Enable token validation before saving the route. Under Additional application settings, turn on Protect with Access and enter the Access team name and the app’s audience (AUD). To find the AUD, edit the Access app and copy the Application Audience (AUD) Tag from Additional settings. Find the team name under Zero Trust > Settings. Save the route. Team name FAQ, Identity-gated edge guide, and JWT validation guide

For a partial CNAME setup, create a CNAME for the app hostname at your authoritative DNS provider. Point it to <hostname>.cdn.cloudflare.net. Partial CNAME setup

Access checks the application token at Cloudflare’s edge. With Protect with Access, cloudflared also validates the signed JWT in Cf-Access-Jwt-Assertion before forwarding the request to the app. Cloudflare also supports validating that token in the application itself. Tunnel origin parameters

Cutover checklist

From an external network with the old VPN disconnected, open the same protected page for each browser check. Start each identity test with a fresh browser profile. Compare the decisions in Access authentication logs with the app’s request logs. Cloudflare’s acceptance tests

  • Check an approved user. Sign in through the configured IdP as a member of the allowed group. The protected page loads and the app log records the request.
  • Check a denied user. Sign in with a valid IdP account outside the allowed group. Access denies the request and the app receives no request for that test.
  • Check a signed-out browser. Open the page without signing in. Expect an Access prompt or denial and no protected content.
  • Confirm connector-side validation is configured. Reopen Edit route for the published hostname. Confirm Protect with Access is enabled with the intended team and app AUD. The browser checks exercise the edge policy. In a controlled test at the connector’s validator, a valid app JWT should pass and a request without one should be rejected before reaching the app. Origin parameters and validator-side acceptance tests
  • Retire the old path and retest. After the checks pass, disable the app’s old inbound firewall rule or remove its port forward. From outside the network, try the old address and port directly. Repeat the allowed and denied checks at the published hostname. If the old path was VPN-only, also test direct access from the old VPN segment. Origin isolation guidance

For an old HTTPS listener, substitute its hostname and public origin IP in this direct test. Use the old scheme and port if they differ. Repeat for every old public origin address. Cloudflare’s direct-to-origin curl examples

curl -svo /dev/null https://app.example.com --connect-to ::203.0.113.34

The direct connection should fail before TLS or HTTP, for example by timing out or being refused. A certificate error or an HTTP response shows the listener is still reachable. Resolve any surviving inbound path before marking the cutover complete.

Policies are identity plus context, not IP ranges

Use the IdP group to identify who needs the app and add any required device checks to the same Allow policy. When removing someone’s access, disable their IdP account and revoke their active Access sessions. Access policy selectors and session management

For a comparison with a private network approach, see Cloudflare Access compared with Tailscale.

How Access evaluates a policy: Include, Exclude, Require, and why Bypass runs first

Include matches any listed rule. Require adds conditions every allowed user must meet. Exclude removes a matching user from that policy. For example, Include the maintenance group, Require a device posture check, and Exclude the suspended group. Access policy rules

Access evaluates Bypass and Service Auth first, in their displayed order. It then evaluates Block and Allow in their displayed order and stops at the first matching Block or Allow. Place an explicit Block before any Allow it must override. Bypass disables Access enforcement and logging for matching requests. Use Service Auth for automated callers that need their own authentication. Access policy actions and evaluation order

What device posture can and cannot check

The Cloudflare One Client can check disk encryption on Windows, macOS and Linux, the firewall on Windows and macOS, and antivirus on Windows. Deploy the client and enable the checks before requiring them. For a mandatory posture rule, repeat the browser test with an allowed user on a device that fails the check and confirm denial. Client posture check matrix

Keep identity in the policy alongside posture. An encryption check reports a specific device property. Cloudflare can also use signals from third-party endpoint tools. Posture checks overview

Posture only mode collects device signals without routing app traffic or DNS. For a private IP route, choose a client mode that sends traffic to Cloudflare. Cloudflare client modes and WARP vs VPN explained

Common mistakes

  • Giving the whole company access. Keep the Allow policy specific to this app’s users. Check for a broader Allow or a Bypass rule before testing. Access policy examples
  • Moving dependent services by accident. Check which callers still use the old path before removing the app’s rule. Inventory non-browser dependencies and move them on an appropriate route separately. Deployment inputs
  • Relying on the login screen. Compare the Access decision with the outcome at the protected page. A successful sign-in can still be followed by an origin failure. Access authentication logs and tunnel errors
  • Missing a connector failure. Error 1033 points to Cloudflare being unable to find a healthy connector. Check tunnel health and connector connectivity. If the tunnel connects but returns a 502 about the origin service, check the service address and whether the connector can reach it. Common tunnel errors and Cloudflare error 1033 fixes

Evidence and limits. The dashboard workflow is based on the Cloudflare One documentation as of November 25, 2026. These steps were not run in a lab.

Sources

  1. Cloudflare One docs: Tunnel with firewall
  2. Cloudflare One docs: Publish a self-hosted application to the Internet
  3. Cloudflare One docs: Private networks
  4. Cloudflare One docs: Connect an IP/CIDR
  5. Cloudflare One docs: Manage Access policies
  6. Cloudflare One docs: Create a tunnel (dashboard)
  7. Cloudflare One docs: Getting started with Cloudflare Zero Trust FAQ
  8. Cloudflare One docs: Validate JWTs
  9. Cloudflare One docs: Origin parameters
  10. Cloudflare Reference Architecture: Design an identity-gated edge
  11. Cloudflare One docs: Access authentication logs
  12. Cloudflare Support: Gathering information for troubleshooting sites
  13. Cloudflare One docs: Access policies
  14. Cloudflare One docs: Session management
  15. Cloudflare One docs: Cloudflare One Client checks
  16. Cloudflare One docs: Posture checks
  17. Cloudflare One docs: Client modes
  18. Cloudflare One docs: Common tunnel errors

Related