From beaafc37c2e94c2b8068a96aeef0b5ada536abb9 Mon Sep 17 00:00:00 2001 From: Pedro Sousa <680496+pedrosousa@users.noreply.github.com> Date: Mon, 2 Jun 2025 16:35:45 +0100 Subject: [PATCH 1/5] [Rules] Update error page types --- src/content/docs/rules/custom-errors/edit-error-pages.mdx | 2 +- .../rules/custom-errors/reference/error-page-types.mdx | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/content/docs/rules/custom-errors/edit-error-pages.mdx b/src/content/docs/rules/custom-errors/edit-error-pages.mdx index fcdb46f4d171fb..4bb029aab836d1 100644 --- a/src/content/docs/rules/custom-errors/edit-error-pages.mdx +++ b/src/content/docs/rules/custom-errors/edit-error-pages.mdx @@ -13,7 +13,7 @@ Before defining a custom error page in your Cloudflare account, you will need to When designing your custom error page, you can include page-specific [custom error tokens](/rules/custom-errors/reference/error-tokens/). Each custom error token provides diagnostic information that appears on the error page. -To display a custom page for each error, create a separate page per error. For example, to create a custom error page for both **IP/Country Block** and **Interactive Challenge**, you must design and publish two separate pages. +To display a custom page for each error, create a separate page per error. For example, to create a custom error page for both **IP/Country Block** and **WAF block**, you must design and publish two separate pages. :::note[Notes] diff --git a/src/content/docs/rules/custom-errors/reference/error-page-types.mdx b/src/content/docs/rules/custom-errors/reference/error-page-types.mdx index c03092f1c3bd3d..8ecb34885a86a5 100644 --- a/src/content/docs/rules/custom-errors/reference/error-page-types.mdx +++ b/src/content/docs/rules/custom-errors/reference/error-page-types.mdx @@ -14,3 +14,10 @@ sidebar: | 1000 class errors | 1000 class error pages are displayed when a domain’s configuration, security settings, or origin setup prevents Cloudflare from completing a request. For more information, refer to [Cloudflare 1XXX errors](/support/troubleshooting/http-status-codes/cloudflare-1xxx-errors/). | | Managed challenge / I'm Under Attack Mode | Presents different types of challenges to a visitor depending on the nature of their request and your security settings. This page returns a `403` status code. For more information, refer to [Under Attack mode](/fundamentals/reference/under-attack-mode/). | | Rate limiting block | Displayed to visitors when they have been blocked by a [rate limiting rule](/waf/rate-limiting-rules/). This page returns a `429` status code. | + +The following error page types will only be shown in the Cloudflare dashboard if you have customized their error pages in the past: + +- Interactive Challenge +- JavaScript Challenge + +These types of challenges are no longer recommended. Refer to [Challenge pages](/cloudflare-challenges/challenge-types/challenge-pages/) for more information. From 59562a2e3174e1dbf4df1c8944599701423b984c Mon Sep 17 00:00:00 2001 From: Pedro Sousa <680496+pedrosousa@users.noreply.github.com> Date: Mon, 2 Jun 2025 16:38:14 +0100 Subject: [PATCH 2/5] Adjust sentence --- .../docs/rules/custom-errors/reference/error-page-types.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/rules/custom-errors/reference/error-page-types.mdx b/src/content/docs/rules/custom-errors/reference/error-page-types.mdx index 8ecb34885a86a5..2f2637ccd92487 100644 --- a/src/content/docs/rules/custom-errors/reference/error-page-types.mdx +++ b/src/content/docs/rules/custom-errors/reference/error-page-types.mdx @@ -20,4 +20,4 @@ The following error page types will only be shown in the Cloudflare dashboard if - Interactive Challenge - JavaScript Challenge -These types of challenges are no longer recommended. Refer to [Challenge pages](/cloudflare-challenges/challenge-types/challenge-pages/) for more information. +These types of challenges are being discouraged in favor of managed challenges. Refer to [Challenge pages](/cloudflare-challenges/challenge-types/challenge-pages/) for more information. From 592827b7f248d790a7085c4500a2e5f5c8780598 Mon Sep 17 00:00:00 2001 From: Pedro Sousa <680496+pedrosousa@users.noreply.github.com> Date: Tue, 3 Jun 2025 10:26:43 +0100 Subject: [PATCH 3/5] Add error page example API calls --- .../docs/rules/custom-errors/api-calls.mdx | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/src/content/docs/rules/custom-errors/api-calls.mdx b/src/content/docs/rules/custom-errors/api-calls.mdx index e80ef612472600..65bf6c9e31043d 100644 --- a/src/content/docs/rules/custom-errors/api-calls.mdx +++ b/src/content/docs/rules/custom-errors/api-calls.mdx @@ -8,6 +8,8 @@ head: content: Common API calls | Custom Error Assets --- +import { APIRequest } from "~/components"; + The following sections provide examples of common API calls for managing custom error assets at the zone level. To perform the same operations at the account level, use the corresponding account-level API endpoints. @@ -167,3 +169,75 @@ To delete an asset at the account level, use the account-level endpoint: ```txt https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/custom_pages/assets/$ASSET_NAME ``` + +### Get error page + +This example obtains the current configuration for the `Rate limiting block` error page (with ID `ratelimit_block`). + + + +```json output +{ + "result": { + "id": "ratelimit_block", + "description": "Rate limit Block", + "required_tokens": [], + "preview_target": "block:rate-limit", + "created_on": "2025-06-03T08:33:17.091587Z", + "modified_on": "2025-06-03T08:33:17.091587Z", + "url": null, + "state": "default" + }, + "success": true, + "errors": [], + "messages": [] +} +``` + +The response indicates that the page is currently set to the Cloudflare default page (`"state": "default"`). + +For a list of error page identifiers, refer to [Error page types](/rules/custom-errors/reference/error-page-types/). + +### Update error page + +This example defines a custom error page for `Rate limiting block` errors (with ID `ratelimit_block`) based on the provided URL. + + + +```json output +{ + "result": { + "id": "ratelimit_block", + "description": "Rate limit Block", + "required_tokens": [], + "preview_target": "block:rate-limit", + "created_on": "2025-06-03T08:33:17.091587Z", + "modified_on": "2025-06-03T08:35:32.639114Z", + "url": "https://example.com/rate_limiting_block_error_page.html", + "state": "customized" + }, + "success": true, + "errors": [], + "messages": [] +} +``` + +To set the error page back to the default page, use `"state": "default"` in the request body. + +For a list of error page identifiers, refer to [Error page types](/rules/custom-errors/reference/error-page-types/). From a0482f3f2b0ed6f5038fcc052a52537ef7b1983a Mon Sep 17 00:00:00 2001 From: Pedro Sousa <680496+pedrosousa@users.noreply.github.com> Date: Tue, 3 Jun 2025 10:27:06 +0100 Subject: [PATCH 4/5] Add API identifiers to page types list --- .../reference/error-page-types.mdx | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/content/docs/rules/custom-errors/reference/error-page-types.mdx b/src/content/docs/rules/custom-errors/reference/error-page-types.mdx index 2f2637ccd92487..b484edc7c1c757 100644 --- a/src/content/docs/rules/custom-errors/reference/error-page-types.mdx +++ b/src/content/docs/rules/custom-errors/reference/error-page-types.mdx @@ -5,19 +5,21 @@ sidebar: order: 4 --- -| Page type | Description | -| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| WAF block | The page displayed when visitors are blocked by a [Web Application Firewall](/waf/) rule. This page returns a `403` status code. | -| IP/Country block | The page displayed when a request originates from an [blocked IP address or country](/waf/tools/ip-access-rules/). This page returns a `403` status code. | -| IP/Country challenge | Presents a challenge to visitors from specified IP addresses or countries. This page returns a `403` status code. For more information, refer to [IP Access rules](/waf/tools/ip-access-rules/). | -| 500 class errors | 500 class error pages are displayed when a web server is unable to process a request. For more information, refer to [Cloudflare 5XX errors](/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/). | -| 1000 class errors | 1000 class error pages are displayed when a domain’s configuration, security settings, or origin setup prevents Cloudflare from completing a request. For more information, refer to [Cloudflare 1XXX errors](/support/troubleshooting/http-status-codes/cloudflare-1xxx-errors/). | -| Managed challenge / I'm Under Attack Mode | Presents different types of challenges to a visitor depending on the nature of their request and your security settings. This page returns a `403` status code. For more information, refer to [Under Attack mode](/fundamentals/reference/under-attack-mode/). | -| Rate limiting block | Displayed to visitors when they have been blocked by a [rate limiting rule](/waf/rate-limiting-rules/). This page returns a `429` status code. | +| Page type | Description | API identifier | +| ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | +| WAF block | The page displayed when visitors are blocked by a [Web Application Firewall](/waf/) rule. This page returns a `403` status code. | `waf_block` | +| IP/Country block | The page displayed when a request originates from an [blocked IP address or country](/waf/tools/ip-access-rules/). This page returns a `403` status code. | `ip_block` | +| IP/Country challenge | Presents a challenge to visitors from specified IP addresses or countries. This page returns a `403` status code. For more information, refer to [IP Access rules](/waf/tools/ip-access-rules/). | `country_challenge` | +| 500 class errors | 500 class error pages are displayed when a web server is unable to process a request. For more information, refer to [Cloudflare 5XX errors](/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/). | `500_errors` | +| 1000 class errors | 1000 class error pages are displayed when a domain’s configuration, security settings, or origin setup prevents Cloudflare from completing a request. For more information, refer to [Cloudflare 1XXX errors](/support/troubleshooting/http-status-codes/cloudflare-1xxx-errors/). | `1000_errors` | +| Managed challenge / I'm Under Attack Mode | Presents different types of challenges to a visitor depending on the nature of their request and your security settings. This page returns a `403` status code. For more information, refer to [Under Attack mode](/fundamentals/reference/under-attack-mode/). | `managed_challenge` | +| Rate limiting block | Displayed to visitors when they have been blocked by a [rate limiting rule](/waf/rate-limiting-rules/). This page returns a `429` status code. | `ratelimit_block` | The following error page types will only be shown in the Cloudflare dashboard if you have customized their error pages in the past: -- Interactive Challenge -- JavaScript Challenge +| Page type | API identifier | +| --------------------- | ----------------- | +| Interactive Challenge | `basic_challenge` | +| JavaScript Challenge | `under_attack` | These types of challenges are being discouraged in favor of managed challenges. Refer to [Challenge pages](/cloudflare-challenges/challenge-types/challenge-pages/) for more information. From ff28fb3693da48392f6d218710de06c9121d64e2 Mon Sep 17 00:00:00 2001 From: Pedro Sousa <680496+pedrosousa@users.noreply.github.com> Date: Tue, 3 Jun 2025 12:08:32 +0100 Subject: [PATCH 5/5] Fix typo --- .../docs/rules/custom-errors/reference/error-page-types.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/rules/custom-errors/reference/error-page-types.mdx b/src/content/docs/rules/custom-errors/reference/error-page-types.mdx index b484edc7c1c757..e2a3a1265cff4e 100644 --- a/src/content/docs/rules/custom-errors/reference/error-page-types.mdx +++ b/src/content/docs/rules/custom-errors/reference/error-page-types.mdx @@ -8,7 +8,7 @@ sidebar: | Page type | Description | API identifier | | ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | | WAF block | The page displayed when visitors are blocked by a [Web Application Firewall](/waf/) rule. This page returns a `403` status code. | `waf_block` | -| IP/Country block | The page displayed when a request originates from an [blocked IP address or country](/waf/tools/ip-access-rules/). This page returns a `403` status code. | `ip_block` | +| IP/Country block | The page displayed when a request originates from a [blocked IP address or country](/waf/tools/ip-access-rules/). This page returns a `403` status code. | `ip_block` | | IP/Country challenge | Presents a challenge to visitors from specified IP addresses or countries. This page returns a `403` status code. For more information, refer to [IP Access rules](/waf/tools/ip-access-rules/). | `country_challenge` | | 500 class errors | 500 class error pages are displayed when a web server is unable to process a request. For more information, refer to [Cloudflare 5XX errors](/support/troubleshooting/http-status-codes/cloudflare-5xx-errors/). | `500_errors` | | 1000 class errors | 1000 class error pages are displayed when a domain’s configuration, security settings, or origin setup prevents Cloudflare from completing a request. For more information, refer to [Cloudflare 1XXX errors](/support/troubleshooting/http-status-codes/cloudflare-1xxx-errors/). | `1000_errors` |