Block pages
Last updated Apr 23, 2026
Enable the block page for DNS policies
For DNS policies, you will need to enable the block page on a per-policy basis.
- In the Cloudflare dashboard ↗︎, go to Zero Trust > Traffic policies > Firewall policies > DNS.
- Select Add a policy to create a new policy, or choose the policy you want to customize and select Edit. You can only edit the block page for policies with a Block action.
- Under Configure policy settings, turn on Modify Gateway block behavior.
- Choose your block behavior:
- Use account-level block setting: Use the global block page setting configured in your account settings. The global setting can be the default Gateway block page, an HTTP redirect, or a custom Gateway block page.
- Override account setting with URL redirect: Redirect users with a
307HTTP redirect to a URL you specify on a policy level. - (Optional) If your account-level block page setting uses a custom Gateway block page, you can turn on Add an additional message to your custom block page when traffic matches this policy to add a custom message to your custom block page when traffic is blocked by this policy. This option will replace the Message field.
- Select Save policy.
Depending on your settings, Gateway will display a block page in your users' browsers or redirect them to a specified URL when they are blocked by this policy.
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.
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/learning-paths/cybersafe/gateway-onboarding/gateway-block-pages/#page","headline":"Block pages","description":"Learn about block pages in this guide.","url":"https://developers.cloudflare.com/learning-paths/cybersafe/gateway-onboarding/gateway-block-pages/","inLanguage":"en","image":"https://developers.cloudflare.com/learning-paths/cybersafe/gateway-onboarding/gateway-block-pages/og.png?v=0748abbb7a863c9b","dateModified":"2026-04-23","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Choose a Gateway DNS connection method. title: Gateway connection methods image: https://developers.cloudflare.com/learning-paths/cybersafe/gateway-onboarding/gateway-connection-methods/og.png?v=2e16d094595e0db5
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/learning-paths/llms.txt
Use this file to discover all available pages before exploring further.
Docs