-
Notifications
You must be signed in to change notification settings - Fork 10k
[Gateway] HTTP + custom block page redirect #20687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 41 commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
27f33f1
Reorder actions
maxvp 5082ab0
Add redirect section
maxvp 57c31c8
Add selectors
maxvp 975ab5d
Add policy options
maxvp 29f467e
Add more context
maxvp c0f2090
Merge branch 'production' into max/gw/http-redirect
maxvp ba8f0af
Add policy context fields
maxvp 5385b1f
Add example table
maxvp 71b01b7
Improve definitions
maxvp 8aa1ee3
Improve context fields
maxvp e54a2cb
Merge branch 'production' into max/gw/http-redirect
maxvp a83f9af
Remove caveat from replace your VPN
maxvp 8c66180
Update customize block page procedure
maxvp ad52fe3
Add redirect section for block page
maxvp 34e857e
Add more details for block page
maxvp cf590f7
Merge branch 'production' into max/gw/http-redirect
maxvp 7ecdd05
Add available selectors partial
maxvp 337ebd1
Update context field table
maxvp 65c4099
Add more info
maxvp 314e6da
Update turn on block page partial
maxvp bd3425c
Add configure section
maxvp 70c2da1
Rearrange sections
maxvp c59d2d3
Add new flow
maxvp 7358b1d
Add policy ID placeholder
maxvp 6eaa36b
Add policy context partial
maxvp bf45e78
Add per policy options
maxvp 50cae9a
Add block notifications to AV scanning
maxvp fbf9054
Add block notifications to DNS and network policies
maxvp d1bb1a1
Remove cert warning
maxvp 56d45d7
Add default block page section
maxvp b49dc96
Write new overview section
maxvp eac51d1
Update customize block page info
maxvp 5edb723
Clarify limitation is DNS level only
maxvp a5513f9
Update client-notifications partial with toggle names
maxvp eb921b0
Revert request warning
maxvp cea683d
Add filter to context fields
maxvp d9c5b63
Improve block page overview
maxvp a0bffd9
Add HTTP redirect examples
maxvp 6c21508
Add redirect precedence to block page
maxvp cf21ea5
Add cross links
maxvp 82e4e66
Update block page in other sections
maxvp ff92aa2
Update src/content/docs/cloudflare-one/policies/gateway/block-page.mdx
maxvp 4c26b35
Add changelog entry
maxvp c437c83
Merge branch 'production' into max/gw/http-redirect
maxvp d46a7b8
Apply suggestions from review
maxvp b0e0895
Apply suggestions from code review
maxvp 940c77e
Delete src/content/changelog/gateway/2025-04-11-http-redirect-custom-…
maxvp 30f9153
Readd changelog
maxvp e49f1c9
Reword changelog
maxvp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,47 +5,67 @@ sidebar: | |
| order: 14 | ||
| --- | ||
|
|
||
| import { Render } from "~/components"; | ||
| import { Render, Tabs, TabItem } from "~/components"; | ||
|
|
||
| Gateway responds to any domain blocked at the DNS level with `0.0.0.0` for IPv4 queries or `::` for IPv6 queries, and does not return that blocked domain's IP address. As a result, the browser will show a browser default error page, and users will not be able to reach that website. This may cause confusion and lead some users to think that their Internet connection is not working. | ||
| When Gateway blocks traffic with a [DNS](/cloudflare-one/policies/gateway/dns-policies/#block) or [HTTP Block policy](/cloudflare-one/policies/gateway/http-policies/#block), you can configure a block page to display in your users' browsers. You can configure the Cloudflare-hosted block page 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. | ||
|
|
||
| Configuring a custom block page in Zero Trust helps avoid this confusion. Your block page will display information such as the rule ID of the policy blocking the website, a policy-specific block message, your organization's name, and a global message you may want to show — for example, a message explaining that the website has been blocked by Gateway and providing any points of contact for support within the organization. | ||
| ## Prerequisites | ||
|
|
||
| Gateway supports custom block pages for DNS and HTTP policies. | ||
| In order to display the block page as the URL of the blocked domain, your organization's devices must have a [Cloudflare certificate](/cloudflare-one/connections/connect-devices/user-side-certificates/manual-deployment/) installed. Enterprise users can also [deploy their own root CA certificate](/cloudflare-one/connections/connect-devices/user-side-certificates/custom-certificate/). If you do not install a certificate, the block page [will not display correctly](#certificate-error). | ||
|
|
||
| :::caution[Default Cloudflare certificate expiring] | ||
| The default Cloudflare root certificate expires on 2025-02-02. | ||
| ## Configure the block page | ||
|
|
||
| If your organization is still using the default Cloudflare certificate, you will need to use a new certificate to display the block page. For more information, refer to [User-side certificates](/cloudflare-one/connections/connect-devices/user-side-certificates/) or [Troubleshooting](/cloudflare-one/faq/troubleshooting/#as-of-february-2-2025-my-end-user-devices-browser-is-returning-a-your-connection-is-not-private-warning). | ||
| ::: | ||
| 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](#configure-policy-block-behavior) on a per-policy basis. | ||
|
|
||
| ## Prerequisites | ||
| To configure the global block page: | ||
|
|
||
| In order to display the block page as the URL of the blocked domain, your devices must have a [Cloudflare certificate](/cloudflare-one/connections/connect-devices/user-side-certificates/manual-deployment/) installed. Enterprise users can also [deploy their own root CA certificate](/cloudflare-one/connections/connect-devices/user-side-certificates/custom-certificate/). If you do not install a certificate, the block page [will not display correctly](#certificate-error). | ||
| 1. In [Zero Trust](https://one.dash.cloudflare.com), go to **Settings** > **Custom Pages**. | ||
| 2. Under **Account Gateway block page**, Gateway will display the current block page setting. Select **Customize**. | ||
| 3. Choose whether to use the [default Gateway block page](#use-the-default-block-page), a [URL redirect](#redirect-to-a-block-page), or a [custom Gateway block page](#customize-the-block-page). | ||
| 4. Select **Save**. | ||
|
|
||
| ## Turn on the block page | ||
| ### Use the default block page | ||
|
|
||
| For all HTTP Block policies, Gateway automatically displays a generic Cloudflare block page. For DNS Block policies, you will need to turn on the block page on a per-policy basis. | ||
| When you choose **Default Gateway block page**, Gateway will display a [block page hosted by Cloudflare](https://blocked.teams.cloudflare.com/). This is the default option for all traffic blocked by Gateway. | ||
|
|
||
| To turn on the block page and specify a custom block message: | ||
| ### Redirect to a block page | ||
|
|
||
| <Render | ||
| file="gateway/add-block-page" | ||
| params={{ | ||
| firewallPolicyPath: | ||
| "**Gateway** > **Firewall policies** > **DNS** or **Gateway** > **Firewall policies** > **HTTP**", | ||
| }} | ||
| /> | ||
| 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: | ||
|
|
||
| 1. In [Zero Trust](https://one.dash.cloudflare.com), go to **Settings** > **Custom Pages**. | ||
| 2. Under **Account Gateway block page**, select **Customize**. | ||
| 3. Choose **URL redirect** | ||
| 4. Enter the URL you want to redirect blocked traffic to. | ||
| 5. (Optional) Turn on **Send policy context** to send [additional policy context](#policy-context) to the redirected URL. | ||
| 6. Select **Save**. | ||
|
|
||
| ## Customize the block page | ||
| 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](/cloudflare-one/policies/gateway/http-policies/#redirect). | ||
|
|
||
| #### Policy context | ||
|
|
||
| <Render file="gateway/policy-context" /> | ||
|
|
||
| #### Redirect precedence | ||
|
|
||
| Paths and queries in the redirect URL take precedence over the original URL. When you turn on **Send policy context**, Gateway will always 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: | ||
|
|
||
| ```txt ins="&[email protected]" | ||
| cloudflare.com/redirect-path?querystring=Y&[email protected] | ||
| ``` | ||
|
|
||
| ### Customize the block page | ||
|
|
||
| <Render file="gateway/customize-block-page" /> | ||
|
|
||
| ### Add a logo image | ||
| #### Add a logo image | ||
|
|
||
| <Render file="gateway/add-logo-image" /> | ||
|
|
||
| ### Allow users to email an administrator | ||
| #### 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: | ||
|
|
||
|
|
@@ -59,6 +79,39 @@ You can add a Mailto link to your custom block page, which allows users to direc | |
| | Device ID | The ID of the device that visited the page. This is generated by the WARP client. | | ||
| | Block Reason | Your policy-specific block message. | | ||
|
|
||
| ## Configure policy block behavior | ||
|
|
||
| For DNS Block policies, you will need to turn on the block page for each policy you want to display it. For HTTP Block policies, Gateway automatically displays your global block page setting by default. You can override your global block page setting for both policy types within each policy's settings. | ||
|
|
||
| To turn on the block page or override your global block page setting for an individual policy: | ||
|
|
||
| <Tabs> | ||
|
|
||
| <TabItem label="DNS policy"> | ||
|
|
||
| <Render | ||
| file="gateway/add-block-page" | ||
| params={{ | ||
| firewallPolicyPath: "**Gateway** > **Firewall policies** > **DNS**", | ||
| blockBehaviorAction: "turn on", | ||
| }} | ||
| /> | ||
|
|
||
| </TabItem> | ||
| <TabItem label="HTTP policy"> | ||
|
|
||
| <Render | ||
| file="gateway/add-block-page" | ||
| params={{ | ||
| firewallPolicyPath: "**Gateway** > **Firewall policies** > **HTTP**", | ||
| blockBehaviorAction: "go to", | ||
| }} | ||
| /> | ||
|
|
||
| </TabItem> | ||
|
|
||
| </Tabs> | ||
|
|
||
| ## Limitations | ||
|
|
||
| ### Certificate error | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.