-
Notifications
You must be signed in to change notification settings - Fork 10.3k
[Rules] Update Custom Errors #19905
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
nikitacano
merged 9 commits into
production
from
pedro/PCX-3214-rules-custom-error-assets
Feb 12, 2025
Merged
[Rules] Update Custom Errors #19905
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
06b6e82
[Rules] Rename section name to Custom Errors (w/ redirects)
pedrosousa 0884e08
Remove empty lines
pedrosousa cce8c56
Update parameter reference
pedrosousa 4ad44ee
Update API page
pedrosousa d78cfb6
Review parameters page
pedrosousa 09e573e
Small updates
pedrosousa bac6f6c
Small fixes
pedrosousa e81627f
Add release note and changelog entry
pedrosousa 74f5f06
Merge branch 'production' into pedro/PCX-3214-rules-custom-error-assets
pedrosousa 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1842,20 +1842,13 @@ | |
| /http-applications/* /version-management/:splat 301 | ||
| /http3/* https://www.cloudflare.com/learning/performance/what-is-http3/ 301 | ||
| /railgun/* / 301 | ||
| /rules/bulk-redirects/* /rules/url-forwarding/bulk-redirects/:splat 301 | ||
| /rules/url-forwarding/dynamic-redirects/* /rules/url-forwarding/single-redirects/:splat 301 | ||
| /ssl/ssl-tls/* /ssl/reference/:splat 301 | ||
| /ssl/reference/cipher-suites/* /ssl/edge-certificates/additional-options/cipher-suites/:splat 301 | ||
| /ssl/reference/migration-guides/digicert-update/* /ssl/reference/migration-guides/ 301 | ||
| /support/account-management-billing/billing-cloudflare-add-on-services/* https://www.cloudflare.com/plans/ 301 | ||
| /tenant/tutorial/* /tenant/get-started/ 301 | ||
| /waf/managed-rulesets/* /waf/managed-rules/:splat 301 | ||
| /firewall/recipes/* /waf/custom-rules/use-cases/:splat 301 | ||
| /workers/wrangler-legacy/* /workers/wrangler/migration/v1-to-v2/wrangler-legacy/:splat 301 | ||
| /waf/custom-rulesets/* /waf/account/custom-rulesets/:splat 301 | ||
| /waf/custom-rules/custom-rulesets/* /waf/account/custom-rulesets/:splat 301 | ||
| /waf/exposed-credentials-check/* /waf/managed-rules/check-for-exposed-credentials/:splat 301 | ||
| /waf/security-events/* /waf/analytics/security-events/:splat 301 | ||
| /firewall/recipes/* /waf/custom-rules/use-cases/:splat 301 | ||
| /web3/polygon-gateway/* /web3/ 301 | ||
| /vectorize/configuration/* /vectorize/best-practices/:splat 301 | ||
|
|
||
|
|
@@ -1904,15 +1897,6 @@ | |
| ## Secure your Internet Traffic | ||
| /learning-paths/secure-internet-traffic/connect-devices/* /learning-paths/secure-internet-traffic/connect-devices-networks/:splat 301 | ||
|
|
||
|
|
||
| # Old WAF changelog entries | ||
| /waf/change-log/2019-* /waf/change-log/historical-2019/ 301 | ||
| /waf/change-log/2020-* /waf/change-log/historical-2020/ 301 | ||
| /waf/change-log/2021-* /waf/change-log/historical-2021/ 301 | ||
| /waf/change-log/2022-* /waf/change-log/historical-2022/ 301 | ||
| /waf/change-log/2023-* /waf/change-log/historical-2023/ 301 | ||
| /waf/change-log/2024-* /waf/change-log/historical-2024/ 301 | ||
|
|
||
| # Cloudflare for SaaS | ||
| /ssl/ssl-for-saas/common-tasks/* /cloudflare-for-platforms/cloudflare-for-saas/ 301 | ||
| /ssl/ssl-for-saas/reference/* /cloudflare-for-platforms/cloudflare-for-saas/reference/ 301 | ||
|
|
@@ -1928,6 +1912,24 @@ | |
| /magic-wan/connector/* /magic-wan/configuration/connector/:splat 301 | ||
| /magic-wan/configuration/connector/dhcp/* /magic-wan/configuration/connector/network-options/dhcp/:splat 301 | ||
|
|
||
| # Rules | ||
| /rules/bulk-redirects/* /rules/url-forwarding/bulk-redirects/:splat 301 | ||
| /rules/url-forwarding/dynamic-redirects/* /rules/url-forwarding/single-redirects/:splat 301 | ||
| /rules/custom-error-responses/* /rules/custom-errors/:splat 301 | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added this new entry. |
||
|
|
||
| # WAF | ||
| /waf/managed-rulesets/* /waf/managed-rules/:splat 301 | ||
| /waf/custom-rulesets/* /waf/account/custom-rulesets/:splat 301 | ||
| /waf/custom-rules/custom-rulesets/* /waf/account/custom-rulesets/:splat 301 | ||
| /waf/exposed-credentials-check/* /waf/managed-rules/check-for-exposed-credentials/:splat 301 | ||
| /waf/security-events/* /waf/analytics/security-events/:splat 301 | ||
| /waf/change-log/2019-* /waf/change-log/historical-2019/ 301 | ||
| /waf/change-log/2020-* /waf/change-log/historical-2020/ 301 | ||
| /waf/change-log/2021-* /waf/change-log/historical-2021/ 301 | ||
| /waf/change-log/2022-* /waf/change-log/historical-2022/ 301 | ||
| /waf/change-log/2023-* /waf/change-log/historical-2023/ 301 | ||
| /waf/change-log/2024-* /waf/change-log/historical-2024/ 301 | ||
|
|
||
| # Workers | ||
| /workers/reference/apis/* /workers/runtime-apis/:splat 301 | ||
| /workers/templates/pages/* /workers/examples/:splat 301 | ||
|
|
||
50 changes: 50 additions & 0 deletions
50
src/content/changelogs-next/2025-02-11-custom-errors-beta.mdx
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 |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| --- | ||
| title: "Custom Errors (beta): Stored Assets & Account-level Rules" | ||
| description: Cloudflare introduces Custom Errors (beta), building on Custom Error Responses with new asset storage capabilities | ||
| products: | ||
| - rules | ||
| date: 2025-02-11T11:00:00Z | ||
| --- | ||
|
|
||
| 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. | ||
|
|
||
| New capabilities: | ||
|
|
||
| - **Custom error assets** – Fetch and store external error pages at the edge for use in error responses. | ||
| - **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. | ||
|
|
||
| To store an external error page on the Cloudflare global network, submit a `POST` request to create an asset: | ||
|
|
||
| ```bash | ||
| curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/custom_pages/assets" \ | ||
| --header "Authorization: Bearer <API_TOKEN>" \ | ||
| --header 'Content-Type: application/json' \ | ||
| --data '{ | ||
| "name": "maintenance", | ||
| "description": "Maintenance template page", | ||
| "url": "https://example.com/" | ||
| }' | ||
| ``` | ||
|
|
||
| Then, reference the stored asset in a custom error rule: | ||
|
|
||
| ```bash | ||
| curl --request PUT \ | ||
| "https://api.cloudflare.com/client/v4/zones/{zone_id}/rulesets/phases/http_custom_errors/entrypoint" \ | ||
| --header "Authorization: Bearer <API_TOKEN>" \ | ||
| --header 'Content-Type: application/json' \ | ||
| --data '{ | ||
| "rules": [ | ||
| { | ||
| "action": "serve_error", | ||
| "action_parameters": { | ||
| "asset_name": "maintenance", | ||
| "content_type": "text/html", | ||
| "status_code": 503 | ||
| }, | ||
| "enabled": true, | ||
| "expression": "http.request.uri.path contains \"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
126 changes: 0 additions & 126 deletions
126
src/content/docs/rules/custom-error-responses/create-api.mdx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
src/content/docs/rules/custom-error-responses/parameters.mdx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some redirects have been moved. Only added one entry.