Skip to content

Commit 344cbef

Browse files
maxvpranbelkodster28
authored andcommitted
[Gateway] HTTP + custom block page redirect (#20687)
Co-authored-by: ranbel <[email protected]> Co-authored-by: Kody Jackson <[email protected]>
1 parent 7fd57db commit 344cbef

File tree

22 files changed

+316
-163
lines changed

22 files changed

+316
-163
lines changed

src/content/changelog/gateway/2025-03-21-pdns-user-locations-role.mdx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@
22
title: Secure DNS Locations Management User Role
33
description: Create secure DNS locations using the new Cloudflare Zero Trust Locations Write role.
44
date: 2025-03-21T13:50:40Z
5-
products: []
5+
products:
6+
- gateway
67
hidden: false
78
---
89

9-
Were excited to introduce the [**Cloudflare Zero Trust Secure DNS Locations Write role**](/cloudflare-one/connections/connect-devices/agentless/dns/locations/#secure-dns-locations), designed to provide DNS filtering customers with granular control over third-party access when configuring their Protective DNS (PDNS) solutions.
10+
We're excited to introduce the [**Cloudflare Zero Trust Secure DNS Locations Write role**](/cloudflare-one/connections/connect-devices/agentless/dns/locations/#secure-dns-locations), designed to provide DNS filtering customers with granular control over third-party access when configuring their Protective DNS (PDNS) solutions.
1011

11-
Many DNS filtering customers rely on external service partners to manage their DNS location endpoints. This role allows you to grant access to external parties to administer DNS locations without overprovisioning their permissions.
12+
Many DNS filtering customers rely on external service partners to manage their DNS location endpoints. This role allows you to grant access to external parties to administer DNS locations without overprovisioning their permissions.
1213

1314
**Secure DNS Location Requirements:**
1415

15-
- Mandate usage of [Bring your own DNS resolver IP addresses](https://developers.cloudflare.com/cloudflare-one/connections/connect-devices/agentless/dns/locations/dns-resolver-ips/#bring-your-own-dns-resolver-ip) if available on the account.
16+
- Mandate usage of [Bring your own DNS resolver IP addresses](https://developers.cloudflare.com/cloudflare-one/connections/connect-devices/agentless/dns/locations/dns-resolver-ips/#bring-your-own-dns-resolver-ip) if available on the account.
1617

17-
- Require source network filtering for IPv4/IPv6/DoT endpoints; token authentication or source network filtering for the DoH endpoint.
18+
- Require source network filtering for IPv4/IPv6/DoT endpoints; token authentication or source network filtering for the DoH endpoint.
1819

1920
You can assign the new role via Cloudflare Dashboard (`Manage Accounts > Members`) or via API. For more information, refer to the [Secure DNS Locations documentation](https://developers.cloudflare.com/cloudflare-one/connections/connect-devices/agentless/dns/locations/#secure-dns-locations).
20-
21-
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: HTTP redirect and custom block page redirect
3+
description: Redirect traffic with a Gateway HTTP Redirect policy, or with the block page in an HTTP or DNS Block policy.
4+
date: 2025-04-11T16:30:00Z
5+
products:
6+
- gateway
7+
hidden: false
8+
---
9+
10+
You can now use more flexible redirect capabilities in Cloudflare One with Gateway.
11+
12+
- A new **Redirect** action is available in the HTTP policy builder, allowing admins to redirect users to any URL when their request matches a policy. You can choose to preserve the original URL and query string, and optionally include policy context via query parameters.
13+
- For **Block** actions, admins can now configure a custom URL to display when access is denied. This block page redirect is set at the account level and can be overridden in DNS or HTTP policies. Policy context can also be passed along in the URL.
14+
15+
Learn more in our documentation for [HTTP Redirect](/cloudflare-one/policies/gateway/http-policies/#redirect) and [Block page redirect](/cloudflare-one/policies/gateway/block-page/#redirect-to-a-block-page).

src/content/docs/cloudflare-one/connections/connect-devices/agentless/dns/dns-over-https.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ curl --silent "https://<ACCOUNT_ID>.cloudflare-gateway.com/dns-query?name=exampl
269269
--header "CF-Authorization: <USER_DOH_TOKEN>" | jq
270270
```
271271

272-
If the site is blocked and you have enabled [**Display block page**](/cloudflare-one/policies/gateway/block-page/#turn-on-the-block-page) for the policy, the query will return `162.159.36.12` (the IP address of the Gateway block page). If the block page is disabled, the response will be `0.0.0.0`.
272+
If the site is blocked and you have turned on the [block page](/cloudflare-one/policies/gateway/block-page/#configure-policy-block-behavior) for the policy, the query will return `162.159.36.12` (the IP address of the Gateway block page). If the block page is disabled, the response will be `0.0.0.0`.
273273

274274
<Details header="Example response">
275275

src/content/docs/cloudflare-one/faq/getting-started-faq.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ After changing your team name, you will need to check your Block page, Login pag
3636
To verify that your team name change is successfully rendering on the Block page, Login page and App Launcher:
3737

3838
1. In [Zero Trust](https://one.dash.cloudflare.com/), go to **Settings** > **Custom Pages**.
39-
2. Find the **Block page** and **Login page** > select **Customize** next to the page you would like to review first.
39+
2. Find the **Account Gateway block page** and **Login page** sections, then select **Customize** next to the page you would like to review first.
4040
3. Review that the value in **Your Organization's name** matches your new team name.
4141
4. If the desired name is not already displayed, change the value to your desired team name and select **Save**.
42-
5. Check both pages (**Block page** and **Login page**) to set **Your Organization's name** as your desired team name.
42+
5. Check both pages (**Account Gateway block page** and **Login page**) to set **Your Organization's name** as your desired team name.
4343

4444
The App Launcher will display the same team name set on the Login page, so you do not need to update the **Your Organization's name** field in the App Launcher page.
4545

src/content/docs/cloudflare-one/policies/gateway/block-page.mdx

Lines changed: 76 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,47 +5,67 @@ sidebar:
55
order: 14
66
---
77

8-
import { Render } from "~/components";
8+
import { Render, Tabs, TabItem } from "~/components";
99

10-
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.
10+
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 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.
1111

12-
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.
12+
## Prerequisites
1313

14-
Gateway supports custom block pages for DNS and HTTP policies.
14+
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).
1515

16-
:::caution[Default Cloudflare certificate expiring]
17-
The default Cloudflare root certificate expires on 2025-02-02.
16+
## Configure the block page
1817

19-
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).
20-
:::
18+
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.
2119

22-
## Prerequisites
20+
To configure the global block page:
2321

24-
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).
22+
1. In [Zero Trust](https://one.dash.cloudflare.com), go to **Settings** > **Custom Pages**.
23+
2. Under **Account Gateway block page**, Gateway will display the current block page setting. Select **Customize**.
24+
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).
25+
4. Select **Save**.
2526

26-
## Turn on the block page
27+
### Use the default block page
2728

28-
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.
29+
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.
2930

30-
To turn on the block page and specify a custom block message:
31+
### Redirect to a block page
3132

32-
<Render
33-
file="gateway/add-block-page"
34-
params={{
35-
firewallPolicyPath:
36-
"**Gateway** > **Firewall policies** > **DNS** or **Gateway** > **Firewall policies** > **HTTP**",
37-
}}
38-
/>
33+
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.
34+
35+
To redirect users to a non-Cloudflare block page:
36+
37+
1. In [Zero Trust](https://one.dash.cloudflare.com), go to **Settings** > **Custom Pages**.
38+
2. Under **Account Gateway block page**, select **Customize**.
39+
3. Choose **URL redirect**
40+
4. Enter the URL you want to redirect blocked traffic to.
41+
5. (Optional) Turn on **Send policy context** to send [additional policy context](#policy-context) to the redirected URL.
42+
6. Select **Save**.
3943

40-
## Customize the block page
44+
Gateway will now redirect users to a custom page when user traffic matches a Block policy with the block page configured.
45+
46+
To create an HTTP policy to redirect URLs, refer to the [Redirect action](/cloudflare-one/policies/gateway/http-policies/#redirect).
47+
48+
#### Policy context
49+
50+
<Render file="gateway/policy-context" />
51+
52+
#### Redirect precedence
53+
54+
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:
55+
56+
```txt ins="&[email protected]"
57+
cloudflare.com/redirect-path?querystring=Y&[email protected]
58+
```
59+
60+
### Customize the block page
4161

4262
<Render file="gateway/customize-block-page" />
4363

44-
### Add a logo image
64+
#### Add a logo image
4565

4666
<Render file="gateway/add-logo-image" />
4767

48-
### Allow users to email an administrator
68+
#### Allow users to email an administrator
4969

5070
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:
5171

@@ -59,6 +79,39 @@ You can add a Mailto link to your custom block page, which allows users to direc
5979
| Device ID | The ID of the device that visited the page. This is generated by the WARP client. |
6080
| Block Reason | Your policy-specific block message. |
6181

82+
## Configure policy block behavior
83+
84+
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.
85+
86+
To turn on the block page or override your global block page setting for an individual policy:
87+
88+
<Tabs>
89+
90+
<TabItem label="DNS policy">
91+
92+
<Render
93+
file="gateway/add-block-page"
94+
params={{
95+
firewallPolicyPath: "**Gateway** > **Firewall policies** > **DNS**",
96+
blockBehaviorAction: "turn on",
97+
}}
98+
/>
99+
100+
</TabItem>
101+
<TabItem label="HTTP policy">
102+
103+
<Render
104+
file="gateway/add-block-page"
105+
params={{
106+
firewallPolicyPath: "**Gateway** > **Firewall policies** > **HTTP**",
107+
blockBehaviorAction: "go to",
108+
}}
109+
/>
110+
111+
</TabItem>
112+
113+
</Tabs>
114+
62115
## Limitations
63116

64117
### Certificate error

src/content/docs/cloudflare-one/policies/gateway/dns-policies/common-policies.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ With the [Request Context Categories](/cloudflare-one/policies/gateway/dns-polic
8282

8383
<Tabs syncKey="dashPlusAPI"> <TabItem label="Dashboard">
8484

85-
| Selector | Operator | Value | Action |
86-
| ------------------------ | -------- | ------- | ------ |
85+
| Selector | Operator | Value | Action |
86+
| ------------------------ | -------- | --------- | ------ |
8787
| Request Context Category | is | _Present_ | Block |
8888

8989
</TabItem>
@@ -485,7 +485,7 @@ Enterprise users can pair these policies with an [egress policy](/cloudflare-one
485485
Optionally, you can use the Domain selector to control the IP version for specific sites.
486486

487487
:::note
488-
To ensure traffic routes through your preferred IP version, disable **Display block page**.
488+
To ensure traffic routes through your preferred IP version, turn off **Modify Gateway block behavior**.
489489
:::
490490

491491
### Force IPv4

src/content/docs/cloudflare-one/policies/gateway/dns-policies/index.mdx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,17 @@ Policies with Block actions block DNS queries to reach destinations you specify
140140

141141
#### Custom block page
142142

143-
When choosing the Block action, turn on **Display custom block page** to respond to queries with a block page and to specify the message you want to display to users who go to blocked websites. If the block page is disabled, Gateway will respond to blocked queries with an `A` record of `0.0.0.0` for IPv4 destinations, or with an `AAAA` record of `::` for IPv6 destinations. For more information, refer to the dedicated documentation on [customizing the block page](/cloudflare-one/policies/gateway/block-page/).
143+
When choosing the Block action, turn on **Modify Gateway block behavior** to respond to queries with a block page to display to users who go to blocked websites. Optionally, you can override your global block page setting with a URL redirect for the specific DNS policy. For more information, refer to [Block page](/cloudflare-one/policies/gateway/block-page/).
144+
145+
If the block page is turned off for a policy, Gateway will respond to queries blocked at the DNS level with an `A` record of `0.0.0.0` for IPv4 destinations, or with an `AAAA` record of `::` for IPv6 destinations. The browser will display its default connection error page.
144146

145147
#### WARP client block notifications
146148

147-
<Render file="gateway/client-notifications-os" product="cloudflare-one" />
149+
<Render
150+
file="gateway/client-notifications"
151+
product="cloudflare-one"
152+
params={{ toggleName: "**Display block notification for WARP Client**" }}
153+
/>
148154

149155
### Override
150156

src/content/docs/cloudflare-one/policies/gateway/dns-policies/test-dns-filtering.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ For example, if you created a policy to block `example.com`, you can do the foll
2323

2424
2. Type `dig example.com` (`nslookup example.com` if you are using Windows) and press **Enter**.
2525

26-
3. If the [block page](/cloudflare-one/policies/gateway/block-page/) is disabled for the policy, you should see `REFUSED` in the answer section:
26+
3. If the [block page](/cloudflare-one/policies/gateway/block-page/) is turned off for the policy, you should see `REFUSED` in the answer section:
2727

2828
```sh
2929
dig example.com

src/content/docs/cloudflare-one/policies/gateway/http-policies/antivirus-scanning.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,18 @@ To turn on AV scanning:
1818
1. In [Zero Trust](https://one.dash.cloudflare.com), go to **Settings** > **Network**.
1919
2. In **Firewall**, turn on **AV inspection**.
2020
3. Choose whether to scan files for malicious payloads during uploads, downloads, or both. You can also block requests containing [non-scannable files](#non-scannable-files).
21+
4. (Optional) Turn on **Display AV block notification for WARP Client** to send [block notifications](#warp-client-block-notifications) to users connected to Gateway with the WARP Client when AV inspection blocks a file.
2122

2223
When a request is blocked due to the presence of malware, Gateway will log the match as a Block decision in your [HTTP logs](/cloudflare-one/insights/logs/gateway-logs/#http-logs).
2324

25+
### WARP client block notifications
26+
27+
<Render
28+
file="gateway/client-notifications"
29+
product="cloudflare-one"
30+
params={{ toggleName: "**Display AV block notification for WARP Client**" }}
31+
/>
32+
2433
## File scan criteria
2534

2635
If AV scanning is turned on, Gateway will use the following criteria to determine whether a file is present in a request or response, and whether to scan that file. The first match will result in the file being scanned.

0 commit comments

Comments
 (0)