Your team runs a dozen internal apps — staging WordPress, Grafana, an internal admin tool, a customer-portal preview build. Each one has its own basic auth, its own forgotten password reset flow, and at least one stale account from a contractor who left in 2024. Cloudflare Access replaces the auth layer on every one of those apps with a single SSO check at the edge. The origin no longer makes the login decision; Cloudflare does, against your existing identity provider, before any request reaches the app.
How to verify
Before configuring anything, confirm two things — the account has the Zero Trust dashboard enabled, and the zone is proxied through Cloudflare:
# The zone must be on Cloudflare (orange-cloud DNS, or routed via Tunnel)
dig +short app.internal.example.com
# 104.21.x.x or 172.67.x.x — proxied through CF
# The account-level API endpoint that lists Access apps
curl -fsS "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/access/apps" \
-H "Authorization: Bearer $CF_API_TOKEN" | jq '.result[] | {name, domain, type}'
# On an already-gated app, the cookie that proves a session
# After login, the browser carries CF_Authorization=<JWT>
curl -sS -I https://app.internal.example.com/ \
-H "Cookie: CF_Authorization=<JWT>"
# 200 OK if the JWT is valid, 302 to /cdn-cgi/access/login/<aud> if not
The Zero Trust dashboard lives at one.dash.cloudflare.com. If your account has no team domain (<team>.cloudflareaccess.com), pick one in Settings → Custom Pages before creating apps — every Access login redirects there.
What’s happening
Access is a reverse-proxy auth layer at the Cloudflare edge. When a request arrives at a hostname that has an Access application defined, Cloudflare checks for a CF_Authorization cookie containing a signed JWT. No cookie or expired JWT means the request is redirected to /cdn-cgi/access/login/<aud>, which kicks off the configured identity provider flow (Google, Okta, Azure AD, generic SAML, generic OIDC, or a built-in one-time PIN). The IdP signs the user in, Access mints a JWT scoped to that application’s audience, and the cookie is set on the application hostname.
The mental model: the origin app no longer authenticates anyone. Either the request arrives with a valid JWT — in which case the origin should still verify the signature against Cloudflare’s JWKS to confirm the request actually came through the edge — or the request doesn’t arrive at all because Access redirected the user away. There are two application types: self-hosted (Access sits in front of your origin, the most common case) and SaaS (Access acts as a SAML/OIDC IdP federated with a third-party SaaS like Salesforce or AWS SSO). This article covers self-hosted; SaaS is configured identically except the destination is a SaaS app, not your origin.
The procedure
-
Add an identity provider. In Zero Trust → Settings → Authentication, click Add new. Pick the IdP type — Google Workspace, Okta, Azure AD, generic SAML, generic OIDC. For Okta you’ll paste the org URL and an Okta API token; for Azure AD you’ll register an app in Entra ID and paste back the client ID / client secret / tenant ID. Test the IdP before saving — Access shows you the email of the account that completed the test login.
-
Define the Access application. In Zero Trust → Access → Applications → Add an application, choose Self-hosted. Fill in the application name, the public hostname (
grafana.internal.example.com), and the session duration. Session duration is the JWT lifetime — typically 24h for staff apps, 1h for sensitive admin tools. -
Write the policy. A policy is an ordered list of rules. Each rule has an action (
Allow,Block,Bypass) and a set of include / require / exclude conditions:Action: Allow Include: Emails ending in @example.com Require: Group "engineering" (from Okta) Session duration: 24hConditions can match email, email domain, IdP groups (synced automatically), country, IP ranges, device posture, or a presented service token. Multiple rules are OR-ed; within a rule, Include / Require / Exclude are AND-ed.
-
Test the application. Open the hostname in an incognito window. You should be redirected to
<team>.cloudflareaccess.com/cdn-cgi/access/login/<aud>, prompted to pick the IdP, bounced through the IdP login, and dropped on the app with aCF_Authorizationcookie set. The cookie is a JWT — paste it into jwt.io to read the claims:email,aud,iss,exp,groups. -
Validate the JWT at the origin. Access protects the hostname at the edge, but defense in depth means the origin should still verify the JWT independently. Otherwise, anyone who finds the origin’s direct IP can bypass the edge. Validate
Cf-Access-Jwt-Assertion(or theCF_Authorizationcookie) against the JWKS athttps://<team>.cloudflareaccess.com/cdn-cgi/access/certs. In Node:import { jwtVerify, createRemoteJWKSet } from 'jose'; const JWKS = createRemoteJWKSet( new URL('https://<team>.cloudflareaccess.com/cdn-cgi/access/certs') ); const AUD = '<application-aud-tag-from-dashboard>'; export async function requireAccess(req) { const token = req.headers['cf-access-jwt-assertion']; if (!token) throw new Error('missing JWT'); const { payload } = await jwtVerify(token, JWKS, { issuer: 'https://<team>.cloudflareaccess.com', audience: AUD, }); return payload; // { email, sub, groups, ... } }The
audvalue is unique per application and listed on the application’s overview page in the dashboard. -
Service tokens for machine traffic. Humans bounce through an IdP; machines do not. For CI/CD pipelines, server-to-server cron jobs, or any non-interactive client, create a Service Token under Access → Service Auth. You’ll get a client ID and client secret. The client sends them as headers:
curl -fsS "https://api.internal.example.com/metrics" \ -H "CF-Access-Client-Id: <client-id>" \ -H "CF-Access-Client-Secret: <client-secret>"Then add a rule to the Access policy:
Action: Service Auth,Include: Service Token "ci-runner-prod". That rule lets the request through without an IdP login. Treat the secret like any other CI credential — store it in your secrets manager, rotate it on a schedule. See /en/knowledge-base/cf-zero-trust-device-posture/ for the rotation playbook.
Common pitfalls
- Policy left in test mode allowing all emails. Easy to ship a
@example.comrule and forget to tighten it before launch; restrict to a specific Okta/Azure group instead of an email domain. - Origin doesn’t validate the JWT. Access at the edge alone is not sufficient — if the origin IP leaks, the protection is gone. Always verify the JWT at the origin against the JWKS.
- Service token secret committed to a repo. The secret has no rotation grace period — once exposed, it must be regenerated and every CI runner updated atomically. Use your secrets manager, not env files in git.
- Wrong
audin JWT verification. The application audience tag is per-application; using one app’s aud in another app’s verifier silently breaks auth without obvious error messages. - No catch-all block policy. If no rule matches a user, the default is to deny — but some teams write only Allow rules and assume coverage. Add an explicit
Blockrule at the end while you tune policies, then remove it once you trust the Allow set.
In the engagements we run, every internal tool sits behind Access — Grafana, ArgoCD, Sentry, the staging copy of the customer app. The IdP is whatever the client already runs (Google Workspace, Okta, Microsoft Entra), and the rotation runbook for service tokens is part of the standard handover. That’s the operating model in Managed Operations.