Skip to content

Commit 39fb3b2

Browse files
authored
[Rules] Changelog: cf.worker.upstream_zone in Transform Rules and 4xx/5xx content fetching in Custom Errors (#22960)
1 parent a391bde commit 39fb3b2

File tree

4 files changed

+60
-6
lines changed

4 files changed

+60
-6
lines changed
110 KB
Loading
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: More flexible fallback handling — Custom Errors now support fetching assets returned with 4xx or 5xx status codes
3+
description: Custom Errors can now fetch and store fallback assets even if the origin returns a 4xx or 5xx status code.
4+
products:
5+
- rules
6+
date: 2025-06-09T18:00:00Z
7+
---
8+
9+
[Custom Errors](/rules/custom-errors/) can now fetch and store [assets](/rules/custom-errors/create-rules/#create-a-custom-error-asset-dashboard) and [error pages](/rules/custom-errors/#error-pages) from your origin even if they are served with a 4xx or 5xx HTTP status code — previously, only 200 OK responses were allowed.
10+
11+
**What’s new:**
12+
- You can now upload error pages and error assets that return error status codes (for example, 403, 500, 502, 503, 504) when fetched.
13+
- These assets are stored and minified at the edge, so they can be reused across multiple Custom Error rules without triggering requests to the origin.
14+
15+
This is especially useful for retrieving error content or downtime banners from your backend when you can’t override the origin status code.
16+
17+
Learn more in the [Custom Errors](/rules/custom-errors/) documentation.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: Match Workers subrequests by upstream zone — cf.worker.upstream_zone now supported in Transform Rules
3+
description: Transform Rules now support the cf.worker.upstream_zone field, letting you conditionally apply rules based on which zone sent Workers subrequest.
4+
products:
5+
- rules
6+
date: 2025-06-09T17:00:00Z
7+
---
8+
9+
import { Example } from "~/components";
10+
11+
You can now use the [`cf.worker.upstream_zone`](/ruleset-engine/rules-language/fields/reference/cf.worker.upstream_zone/) field in [Transform Rules](/rules/transform/) to control rule execution based on whether a request originates from [Workers](/workers/), including subrequests issued by Workers in other zones.
12+
13+
![Match Workers subrequests by upstream zone in Transform Rules](~/assets/images/changelog/rules/transform-rule-subrequest-matching.png)
14+
15+
**What's new:**
16+
- `cf.worker.upstream_zone` is now supported in Transform Rules expressions.
17+
- Skip or apply logic conditionally when handling [Workers subrequests](/workers/platform/limits/#subrequests).
18+
19+
For example, to add a header when the subrequest comes from another zone:
20+
21+
<Example>
22+
23+
Text in **Expression Editor** (replace `myappexample.com` with your domain):
24+
25+
```txt
26+
(cf.worker.upstream_zone != "" and cf.worker.upstream_zone != "myappexample.com")
27+
```
28+
29+
Selected operation under **Modify request header**: _Set static_
30+
31+
**Header name**: `X-External-Workers-Subrequest`
32+
33+
**Value**: `1`
34+
35+
</Example>
36+
37+
This gives you more granular control in how you handle incoming requests for your zone.
38+
39+
Learn more in the [Transform Rules](/rules/transform/) documentation and [Rules language fields](/ruleset-engine/rules-language/fields/reference/) reference.

src/content/docs/rules/custom-errors/troubleshooting.mdx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ sidebar:
88

99
## Cannot preview error page
1010

11-
If Cloudflare cannot load your site or you have blocked the United States (US) via [IP Access rules](/waf/tools/ip-access-rules/) or WAF custom rules, publishing and previewing the error page will not work.
11+
If Cloudflare cannot load your site or you have blocked the United States (US) via [IP Access rules](/waf/tools/ip-access-rules/) or WAF custom rules, publishing and previewing a custom error page might not work.
1212

1313
A common error might look like the following: `Error fetching page: Fetch failed, https://example.com/ipcountryblock.html returned 403 (Code: 1202)`.
1414

15-
Make sure that you are serving the custom error page with an `HTTP 200` status code, and that no WAF rule is blocking or challenging your custom error page.
15+
Make sure that no WAF rule is blocking or challenging Custom Errors product when it is fetching the content of your custom error page.
1616

1717
## Error pages for blocked requests
1818

1919
If you block countries or IP addresses with an [IP Access rule](/waf/tools/ip-access-rules/), affected visitors will get a `1005` error and your **IP/Country Block** custom page.
2020

21-
If you block countries or IP addresses with a [WAF custom rule](/waf/custom-rules/) and you do not configure a [custom response](/waf/custom-rules/create-dashboard/#configure-a-custom-response-for-blocked-requests) for blocked requests in the rule, affected visitors will get your **WAF Block** page.
21+
If you block countries or IP addresses with a [WAF custom rule](/waf/custom-rules/) and you do not configure a [custom error rule](/rules/custom-errors/create-rules/#create-a-custom-error-rule-dashboard) or a [WAF custom response](/waf/custom-rules/create-dashboard/#configure-a-custom-response-for-blocked-requests) for blocked requests, affected visitors will get your **WAF Block** page.
2222

23-
If you block requests due to a [rate limiting rule](/waf/rate-limiting-rules/) and you do not configure a [custom response for blocked requests](/waf/rate-limiting-rules/create-zone-dashboard/#configure-a-custom-response-for-blocked-requests) in the rule, affected visitors will get your **429 Errors** page displaying a Cloudflare `1015` error.
23+
If you block requests due to a [rate limiting rule](/waf/rate-limiting-rules/) and you do not configure a [custom error rule](/rules/custom-errors/create-rules/#create-a-custom-error-rule-dashboard) or a [WAF custom response](/waf/rate-limiting-rules/create-zone-dashboard/#configure-a-custom-response-for-blocked-requests) for blocked requests, affected visitors will get your **429 Errors** page displaying a Cloudflare `1015` error.
2424

2525
If you block countries or IP addresses with a firewall rule (now deprecated), affected visitors will get your **1000 Class Errors** page.
2626

@@ -41,8 +41,6 @@ Your custom error page cannot be blank and cannot exceed 1.5 MB in size (1,500,0
4141

4242
If you encounter errors while attempting to preview or publish your custom error page, use an [HTML validator](https://validator.w3.org/) to ensure that your code resolves properly.
4343

44-
Make sure that you are serving the custom error page with an `HTTP 200` status code.
45-
4644
## More resources
4745

4846
- [HTTP Status Codes](/support/troubleshooting/http-status-codes/)

0 commit comments

Comments
 (0)