Block page
Last updated Oct 12, 2026 When Gateway blocks traffic with a DNS or HTTP Block policy, you can configure a block page to display in your users' browsers. You can provide a descriptive reason for blocking traffic and contact information, or you can redirect your users' browsers to another page. You can apply these customizations globally for every Block policy, or override the settings on a per-policy basis.
Prerequisites
In order to display the block page as the URL of the blocked domain, your organization's devices must have a Cloudflare certificate installed. Enterprise users can also deploy their own root CA certificate. If you do not install a certificate, the block page will not display correctly.
Configure the block page
Gateway will display a global block page in the browser of any user whose traffic is blocked. By default, Gateway will display the block page for any DNS Block policies you turn it on for and all HTTP Block policies. You can turn on or override the global setting on a per-policy basis.
To configure the global block page:
- In Cloudflare One ↗︎, go to Reusable components > Custom pages.
- Under Account Gateway block page, Gateway will display the current block page setting. Select Manage.
- Choose whether to use the default Gateway block page, a URL redirect, or a custom Gateway block page.
- Select Save.
Use the default block page
When you choose Default Gateway block page, Gateway will display a block page hosted by Cloudflare ↗︎. This is the default option for all traffic blocked by Gateway.
Redirect to a block page
Instead of displaying the Cloudflare block page, you can configure Gateway to return a 307 (Temporary Redirect) HTTP response code and redirect to a custom URL.
To redirect users to a non-Cloudflare block page:
- In Cloudflare One ↗︎, go to Reusable components > Custom pages.
- Under Account Gateway block page, select Manage.
- Choose URL redirect.
- Enter the URL you want to redirect blocked traffic to.
- (Optional) Turn on Send policy context to send additional policy context to the redirected URL.
- Select Save.
Gateway will now redirect users to a custom page when user traffic matches a Block policy with the block page configured.
To create an HTTP policy to redirect URLs, refer to the Redirect action.
Policy context
When you turn on Send policy context, Gateway will append details of the matching request to the redirected URL as a query string. Not every context field will be included. Potential policy context fields include:
<details>
<summary>
Policy context fields
</summary>
| Field | Definition | Example |
|---|---|---|
| User email | Email of the user that made the query. | <code>&cf_user_email=user@example.com</code> |
| Site URL | Full URL of the original HTTP request or domain name in DNS query. | <code>&cf_site_uri=https%3A%2F%2Fmalware.testcategory.com%2F</code> |
| URL category | <a href="https://developers.cloudflare.com/cloudflare-one/traffic-controls/domain-categories/">Domain categories</a> of the URL to be redirected. | <code>&cf_request_categories=New%20Domains,Newly%20Seen%20Domains</code> |
| Original HTTP referer | For HTTP traffic, the original HTTP referer header of the HTTP request. | <code>&cf_referer=https%3A%2F%2Fexample.com%2F</code> |
| Rule ID | ID of the Gateway policy that matched the request. | <code>&cf_rule_id=6d48997c-a1ec-4b16-b42e-d43ab4d071d1</code> |
| Source IP | Source IP address of the device that matched the policy. | <code>&cf_source_ip=203.0.113.5</code> |
| Device ID | UUID of the device that matched the policy. | <code>&cf_device_id=6d48997c-a1ec-4b16-b42e-d43ab4d071d1</code> |
| Application names | Name of the application the redirected domain corresponds to, if any. | <code>&cf_application_name=Salesforce</code> |
| Filter | The traffic type filter that triggered the block. | <code>&cf_filter=http</code>, <code>&cf_filter=dns</code>, <code>&cf_filter=av</code>, or <code>&cf_filter=l4</code> |
| Account ID | <a href="https://developers.cloudflare.com/fundamentals/account/find-account-and-zone-ids/">Cloudflare account ID</a> of the associated Zero Trust account. | <code>&cf_account_id=d57c3de47a013c03ca7e237dd3e61d7d</code> |
| Query ID | ID of the DNS query for which the redirect took effect. | <code>&cf_query_id=f8dc6fd3-a7a5-44dd-8b77-08430bb4fac3</code> |
| Connection ID | ID of the proxy connection for which the redirect took effect. | <code>&cf_connection_id=f8dc6fd3-a7a5-44dd-8b77-08430bb4fac3</code> |
| Request ID | ID of the HTTP request for which the redirect took effect. | <code>&cf_request_id=f8dc6fd3-a7a5-44dd-8b77-08430bb4fac3</code> |
</details>
Redirect precedence
Paths and queries in the redirect URL take precedence over the original URL. When you turn on Send policy context, Gateway will append context to the end of the redirected URL. For example, if the original URL is example.com/path/to/page?querystring=X&k=1 and the redirect URL is cloudflare.com/redirect-path?querystring=Y, Gateway will redirect requests to:
cloudflare.com/redirect-path?querystring=Y&cf_user_email=user@example.com
Customize the block page
You can customize the Cloudflare-hosted block page by making global changes that Gateway will display every time a user reaches your block page. Customizations will apply regardless of the type of policy (DNS or HTTP) that blocks the traffic.
To customize your block page:
- In the Cloudflare dashboard ↗︎, go to Zero Trust > Reusable components > Custom pages.
- Under Account Gateway block page, select Customize.
- Choose Custom Gateway block page. Gateway will display a preview of your custom block page. Available customizations include:
- Your organization's name
- Logo
- Header text
- Global block message, which will be displayed above the policy-specific block message
- Mailto link
- Background color
-
Select Save.
-
Add the following permission to your
cloudflare_api_token↗︎: Zero Trust Write- In
cloudflare_zero_trust_gateway_settings↗︎, configure theblock_pageargument with your customizations:
tf
resource "cloudflare_zero_trust_gateway_settings" "team_name" {
account_id = var.cloudflare_account_id
settings = {
block_page = {
enabled = true //do not use the default Gateway block page
mode = "customized_block_page" //use a custom block page
name = "Cloudflare"
logo_path = "https://logos.com/a.png"
header_text = "--header--"
footer_text = "--footer--"
mailto_address = "admin@example.com"
mailto_subject = "Blocked Request"
background_color = "#ffffff"
suppress_footer = false
}
}
}
Gateway will now display a custom Gateway block page when your users visit a blocked website.
Add a logo image
You can include an external logo image to display on your custom block page. The block page resizes all images to 146x146 pixels. The URL must be valid and no longer than 2048 characters. Accepted file types include SVG, PNG, JPEG, and GIF.
Allow users to email an administrator
You can add a Mailto link to your custom block page, which allows users to directly email you about the blocked site. When users select Contact your Administrator on your block page, an email template opens with the email address and subject line you configure, as well as the following diagnostic information:
| Field | Description |
|---|---|
| Site URL | The URL of the blocked page. |
| Rule ID | The ID of the Gateway policy that blocked the page. |
| Source IP | The public source IP of the user device. |
| Account ID | The Cloudflare account associated with the block policy. |
| User ID | The ID of the user who visited the page. Currently, User IDs are not surfaced in the dashboard and can only be viewed by calling the API. |
| Device ID | The ID of the device that visited the page. This is generated by the Cloudflare One Client. |
| Block Reason | Your policy-specific block message. |
