Skip to content

Commit 50ed012

Browse files
authored
[Rules] Update Custom Errors (#19905)
* [Rules] Rename section name to Custom Errors (w/ redirects) * Remove empty lines * Update parameter reference * Update API page * Review parameters page * Small updates * Small fixes * Add release note and changelog entry
1 parent 446e588 commit 50ed012

File tree

15 files changed

+533
-265
lines changed

15 files changed

+533
-265
lines changed

public/_redirects

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,20 +1842,13 @@
18421842
/http-applications/* /version-management/:splat 301
18431843
/http3/* https://www.cloudflare.com/learning/performance/what-is-http3/ 301
18441844
/railgun/* / 301
1845-
/rules/bulk-redirects/* /rules/url-forwarding/bulk-redirects/:splat 301
1846-
/rules/url-forwarding/dynamic-redirects/* /rules/url-forwarding/single-redirects/:splat 301
18471845
/ssl/ssl-tls/* /ssl/reference/:splat 301
18481846
/ssl/reference/cipher-suites/* /ssl/edge-certificates/additional-options/cipher-suites/:splat 301
18491847
/ssl/reference/migration-guides/digicert-update/* /ssl/reference/migration-guides/ 301
18501848
/support/account-management-billing/billing-cloudflare-add-on-services/* https://www.cloudflare.com/plans/ 301
18511849
/tenant/tutorial/* /tenant/get-started/ 301
1852-
/waf/managed-rulesets/* /waf/managed-rules/:splat 301
1853-
/firewall/recipes/* /waf/custom-rules/use-cases/:splat 301
18541850
/workers/wrangler-legacy/* /workers/wrangler/migration/v1-to-v2/wrangler-legacy/:splat 301
1855-
/waf/custom-rulesets/* /waf/account/custom-rulesets/:splat 301
1856-
/waf/custom-rules/custom-rulesets/* /waf/account/custom-rulesets/:splat 301
1857-
/waf/exposed-credentials-check/* /waf/managed-rules/check-for-exposed-credentials/:splat 301
1858-
/waf/security-events/* /waf/analytics/security-events/:splat 301
1851+
/firewall/recipes/* /waf/custom-rules/use-cases/:splat 301
18591852
/web3/polygon-gateway/* /web3/ 301
18601853
/vectorize/configuration/* /vectorize/best-practices/:splat 301
18611854

@@ -1904,15 +1897,6 @@
19041897
## Secure your Internet Traffic
19051898
/learning-paths/secure-internet-traffic/connect-devices/* /learning-paths/secure-internet-traffic/connect-devices-networks/:splat 301
19061899

1907-
1908-
# Old WAF changelog entries
1909-
/waf/change-log/2019-* /waf/change-log/historical-2019/ 301
1910-
/waf/change-log/2020-* /waf/change-log/historical-2020/ 301
1911-
/waf/change-log/2021-* /waf/change-log/historical-2021/ 301
1912-
/waf/change-log/2022-* /waf/change-log/historical-2022/ 301
1913-
/waf/change-log/2023-* /waf/change-log/historical-2023/ 301
1914-
/waf/change-log/2024-* /waf/change-log/historical-2024/ 301
1915-
19161900
# Cloudflare for SaaS
19171901
/ssl/ssl-for-saas/common-tasks/* /cloudflare-for-platforms/cloudflare-for-saas/ 301
19181902
/ssl/ssl-for-saas/reference/* /cloudflare-for-platforms/cloudflare-for-saas/reference/ 301
@@ -1928,6 +1912,24 @@
19281912
/magic-wan/connector/* /magic-wan/configuration/connector/:splat 301
19291913
/magic-wan/configuration/connector/dhcp/* /magic-wan/configuration/connector/network-options/dhcp/:splat 301
19301914

1915+
# Rules
1916+
/rules/bulk-redirects/* /rules/url-forwarding/bulk-redirects/:splat 301
1917+
/rules/url-forwarding/dynamic-redirects/* /rules/url-forwarding/single-redirects/:splat 301
1918+
/rules/custom-error-responses/* /rules/custom-errors/:splat 301
1919+
1920+
# WAF
1921+
/waf/managed-rulesets/* /waf/managed-rules/:splat 301
1922+
/waf/custom-rulesets/* /waf/account/custom-rulesets/:splat 301
1923+
/waf/custom-rules/custom-rulesets/* /waf/account/custom-rulesets/:splat 301
1924+
/waf/exposed-credentials-check/* /waf/managed-rules/check-for-exposed-credentials/:splat 301
1925+
/waf/security-events/* /waf/analytics/security-events/:splat 301
1926+
/waf/change-log/2019-* /waf/change-log/historical-2019/ 301
1927+
/waf/change-log/2020-* /waf/change-log/historical-2020/ 301
1928+
/waf/change-log/2021-* /waf/change-log/historical-2021/ 301
1929+
/waf/change-log/2022-* /waf/change-log/historical-2022/ 301
1930+
/waf/change-log/2023-* /waf/change-log/historical-2023/ 301
1931+
/waf/change-log/2024-* /waf/change-log/historical-2024/ 301
1932+
19311933
# Workers
19321934
/workers/reference/apis/* /workers/runtime-apis/:splat 301
19331935
/workers/templates/pages/* /workers/examples/:splat 301
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: "Custom Errors (beta): Stored Assets & Account-level Rules"
3+
description: Cloudflare introduces Custom Errors (beta), building on Custom Error Responses with new asset storage capabilities
4+
products:
5+
- rules
6+
date: 2025-02-11T11:00:00Z
7+
---
8+
9+
Cloudflare introduces [Custom Errors](/rules/custom-errors/) (beta), building on Custom Error Responses with new asset storage capabilities. This update allows users to store externally hosted error pages at Cloudflare edge and reference them in custom error rules, eliminating the need to supply inline content.
10+
11+
New capabilities:
12+
13+
- **Custom error assets** – Fetch and store external error pages at the edge for use in error responses.
14+
- **Account-Level custom errors** – Define error handling rules and assets at the account level for consistency across multiple zones. Zone-level rules take precedence over account-level ones, and assets are not shared between levels.
15+
16+
To store an external error page on the Cloudflare global network, submit a `POST` request to create an asset:
17+
18+
```bash
19+
curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/custom_pages/assets" \
20+
--header "Authorization: Bearer <API_TOKEN>" \
21+
--header 'Content-Type: application/json' \
22+
--data '{
23+
"name": "maintenance",
24+
"description": "Maintenance template page",
25+
"url": "https://example.com/"
26+
}'
27+
```
28+
29+
Then, reference the stored asset in a custom error rule:
30+
31+
```bash
32+
curl --request PUT \
33+
"https://api.cloudflare.com/client/v4/zones/{zone_id}/rulesets/phases/http_custom_errors/entrypoint" \
34+
--header "Authorization: Bearer <API_TOKEN>" \
35+
--header 'Content-Type: application/json' \
36+
--data '{
37+
"rules": [
38+
{
39+
"action": "serve_error",
40+
"action_parameters": {
41+
"asset_name": "maintenance",
42+
"content_type": "text/html",
43+
"status_code": 503
44+
},
45+
"enabled": true,
46+
"expression": "http.request.uri.path contains \"error\""
47+
}
48+
]
49+
}'
50+
```

src/content/changelogs/rules.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ productLink: "/rules/"
55
productArea: Application performance
66
productAreaLink: /fundamentals/reference/changelog/performance/
77
entries:
8+
- publish_date: "2025-02-11"
9+
title: "Custom Errors (beta): Stored assets and account-level rules"
10+
description: |-
11+
Cloudflare introduces [Custom Errors](/rules/custom-errors/) (beta), expanding on Custom Error Responses with new asset storage capabilities. With custom error assets, you can now retrieve and store externally hosted error pages at Cloudflare edge and reference them in custom error rules, eliminating the need to define error content inline. Additionally, Custom Errors now support account-level rules and assets, enabling consistent error handling across multiple zones.
812
- publish_date: "2025-01-29"
913
title: New Snippets code editor
1014
description: |-

src/content/docs/rules/custom-error-responses/create-api.mdx

Lines changed: 0 additions & 126 deletions
This file was deleted.

src/content/docs/rules/custom-error-responses/index.mdx

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/content/docs/rules/custom-error-responses/parameters.mdx

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)