Skip to content
AnswerWell geo Documentation

Research · 8 min read · Answerwell

Zero Trust Custom Pages: Access Login, Denial Templates, and Block Redirects

How Cloudflare One custom pages work for Access login and denials, block redirects, Liquid templates, and Gateway block pages.

This page summarizes Cloudflare One documentation on Reusable components > Custom pages: what end users see when they sign in to an Access application, fail a policy, approve a CLI login, or are blocked by Gateway. Custom pages change branding and messaging; they do not change who is allowed in.

Access custom pages: what changes when login or access is denied

Section titled “Access custom pages: what changes when login or access is denied”

Access custom pages let you customize pages visitors see when they sign in, receive an Access policy denial, or approve a command-line login. Templates use HTML and Liquid to show request-specific information.

Access custom pages let you customize the pages visitors see when they sign in, receive an Access policy denial, or approve a command-line login. Templates use HTML and Liquid to display request-specific information.

— Cloudflare, Access custom pages

Custom pages change the presentation, not the Access decision. They do not grant access or replace your authentication and authorization policies.

— Cloudflare, Access custom pages

Newer releases extend the same model to login, identity-denied, forbidden, and CLI approval flows in one place:

Cloudflare Access now supports HTML and Liquid templates for login, identity-denied, forbidden, and command-line approval pages. Custom templates allow you to control the branding and appearance of each supported page. Liquid variables allow you to provide custom instructions to users or provide a clear reason why they were blocked.

— Cloudflare, Fully customize user-facing Access pages

Create templates in the Cloudflare One dashboard, validate them in the editor, and assign them to applications or set account defaults. For page types, required controls, and examples, see Access custom pages.

Page types: Login, Identity denied, Forbidden, and Interstitial

Section titled “Page types: Login, Identity denied, Forbidden, and Interstitial”

Create a separate template for each page type. Each type has a fixed purpose after creation.

Type When users see it Required control
Login Sign in to an Access application Exactly one <cf-access-authbox></cf-access-authbox>
Identity denied Denial after sign-in (auth succeeded, policy did not) None
Forbidden Non-identity policy denial (e.g. country, IP, device posture) None
Interstitial Approve or deny a command-line login Exactly one <cf-access-cli-approval></cf-access-cli-approval>

Access inserts sign-in and approval controls into those elements. Keep them visible and outside Liquid conditions or loops. They must render exactly once at runtime—not only appear once in source. Do not replace them with custom forms, IdP links, or approval buttons.

Cloudflare evaluates non-identity attributes before prompting login, so users may see Forbidden without a login page. Identity denied appears after IdP login when an identity rule blocks them (email, group, external evaluation). You can assign different templates for identity vs non-identity failures on each application; see Access custom block pages.

Access may return a Forbidden-style outcome instead of login when policy cannot be satisfied—for example, geolocation outside allowed countries (Policies FAQ).

Access block pages: default, redirect URL, and hosted HTML template

Section titled “Access block pages: default, redirect URL, and hosted HTML template”

For failures on Access applications, Access custom block pages describe three options (alongside the newer per-type custom pages above):

Option Behavior
Default Cloudflare-branded block page
Custom Redirect URL Redirect blocked requests to your URL with query parameters
Custom Page Template HTML hosted by Cloudflare (Pay-as-you-go and Enterprise only)

The block-page article notes that HTML and Liquid customization for login and denial should follow Access custom pages; legacy block-page templates remain documented on Access custom block pages.

Custom redirect URL parameters: kid, account_id, and original_url

Section titled “Custom redirect URL parameters: kid, account_id, and original_url”

When Access redirects to a Custom Redirect URL, it appends:

Parameter Description
kid Application audience (AUD) tag
account_id Cloudflare account ID that owns the application (omitted if account context unavailable)
original_url Requested hostname and path, including query string (when request state is available)

Example shape:

https://denied.example.com/?kid=<APP_AUD>&account_id=<ACCOUNT_ID>&original_url=app.example.com%2Fadmin

App-aware Cloudflare Access deny redirects include an account_id query parameter when account context is available. Custom block pages can use it to identify the account that owns the application represented by kid.

— Cloudflare, Account context in Access deny redirects

Use account_id with account-scoped APIs when looking up the application; match kid to the application’s AUD tag, not its application ID (Custom redirect URL parameters).

For dynamic deny pages (e.g. hosted on Cloudflare Workers), treat parameters as display and routing hints only.

Gateway block page: browser blocks vs Access denials

Section titled “Gateway block page: browser blocks vs Access denials”

Gateway shows a different block experience when DNS or HTTP Block policies match. That is not the same as Access application block pages:

The Gateway custom block page is a different concept from Access custom block pages, which are used in conjunction with Cloudflare Access policies.

— Cloudflare, Gateway block page

When Gateway blocks with a DNS or HTTP Block policy, you can show a descriptive page, contact info, or redirect—globally or per policy (Gateway block page).

Account-level choices:

  • Default Gateway block page (Cloudflare-hosted)
  • URL redirect (307 to your URL; optional Send policy context)
  • Custom Gateway block page (branding, logo, messages, mailto)

DNS Block policies need the block page enabled per policy; HTTP Block policies use the global setting by default unless overridden (Gateway block page, DNS policies). If the block page is off for a DNS policy, blocked queries may return 0.0.0.0 / :: and the browser shows a connection error instead of your page.

Send policy context on Gateway redirect URLs

Section titled “Send policy context on Gateway redirect URLs”

With Send policy context, Gateway appends matching-request details to the redirect URL. Not every field is always present. Examples include cf_user_email, cf_site_uri, cf_rule_id, cf_source_ip, cf_device_id, cf_filter, and cf_account_id (Gateway block page).

Paths and queries in your redirect URL take precedence; context is appended at the end (Gateway block page).

Create Access custom pages and assign them to applications

Section titled “Create Access custom pages and assign them to applications”
  1. In Cloudflare One, open Reusable components > Custom pages.

  2. On Access custom pages, select Manage, then Create custom page.

  3. Enter a unique Name and Type. Edit HTML and Liquid; keep the required control on Login and Interstitial types.

  4. Use Variables for available data; fix Problems before Publish. If validation is unavailable, Retry validation first.

  5. For a self-hosted Access application, go to Access controls > Applications, open Additional settings > custom page settings, pick the template per page type, and Save (Assign a page to an application).

Mapping from application settings to template types:

Application setting Template type
Identity failure block page Identity denied
Non-identity failure block page Forbidden
Login page Login
Interstitial page Interstitial

Account defaults apply when no application-specific template is set; application assignment wins over account default (Account defaults).

Publishing saves a reusable template. Test against an isolated application before wide rollout—editor validation is not a full rendered preview (Create a custom page).

Legacy Access login branding (dashboard-only)

Section titled “Legacy Access login branding (dashboard-only)”

Separately, Access login page documents simpler branding (organization name, logo, header/footer, background) with a live preview; saved changes apply to all Access applications. For full HTML and Liquid control, prefer Access custom pages.

Liquid template data, restrictions, and maintenance

Section titled “Liquid template data, restrictions, and maintenance”

Use the editor Variables list per page type; do not assume every type exposes the same fields (Template data). Guard optional values with Liquid conditions—user may be absent on some denial pages; policy_evaluation is structured data, not a ready-made user message.

Templates run in a restricted Liquid environment:

  • No customer JavaScript, inline handlers, or custom auth forms
  • Tags such as include, render, layout, echo, and raw are unavailable
  • HTML and CSS are sanitized; external assets must meet the page CSP (HTTPS images/fonts)
  • Parsing, rendering, and memory limits apply

If a template cannot render safely, Access falls back to a built-in page without changing the policy decision (Template restrictions).

Keep HTML and Liquid outside the dashboard—the editor does not offer a rendered preview or Download for the newer custom pages flow (Edit and maintain templates). Editing a shared template affects every application that references it.

Minimal login example (required authbox):

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Sign in to {{ app_name }}</title>
</head>
<body>
<main>
<h1>Sign in to {{ app_name }}</h1>
{% if message.text.size > 0 %}
<p role="status">{{ message.text }}</p>
{% endif %}
<cf-access-authbox></cf-access-authbox>
</main>
</body>
</html>

(Source: Login template example)

Common mistakes when customizing denial and block pages

Section titled “Common mistakes when customizing denial and block pages”
  • Hiding <cf-access-authbox> or <cf-access-cli-approval> inside Liquid branches, so the control does not render exactly once.
  • Hardcoding identity provider URLs or treating kid / account_id as proof the user is authorized.
  • Assuming Problems cleared in the editor means every runtime Liquid branch works on mobile or with long text.
  • Publishing edits to a template used by many applications without testing on one app first.
  • Confusing Gateway block pages with Access block pages, or expecting a Gateway browser block page when only DNS returns 0.0.0.0 (DNS policies).
  • Expecting a custom Gateway block page when HTTP and DNS are handled at different data centers or from different IPs—Gateway may show the default page (Gateway block page).
  1. In the Cloudflare dashboard, confirm saved Access custom page templates are Published and assigned under Applications > Additional settings (or account defaults).
  2. Trigger a Login flow and confirm <cf-access-authbox> appears and message.text shows when sign-in errors occur.
  3. Deliberately fail an identity policy after login and an non-identity policy before login; confirm Identity denied vs Forbidden templates match your assignments (Access custom block pages).
  4. If using Custom Redirect URL, capture the redirect and verify kid, account_id (when present), and original_url on a test deny (Custom redirect URL parameters).
  5. For Gateway, enable block behavior on a test DNS or HTTP Block policy, confirm the account-level page or redirect, and optionally verify cf_* parameters when Send policy context is on (Gateway block page).
  6. 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 statement you are asking about.