-
Notifications
You must be signed in to change notification settings - Fork 10.4k
[Rules] Changelog: cf.worker.upstream_zone in Transform Rules and 4xx/5xx content fetching in Custom Errors #22960
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
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
Binary file added
BIN
+110 KB
src/assets/images/changelog/rules/transform-rule-subrequest-matching.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions
17
src/content/changelog/rules/2025-06-09-custom-errors-fetch-4xx-5xx-assets.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,17 @@ | ||
| --- | ||
| title: More flexible fallback handling — Custom Errors now support fetching assets returned with 4xx or 5xx status codes | ||
| description: Custom Errors can now fetch and store fallback assets even if the origin returns a 4xx or 5xx status code. | ||
| products: | ||
| - rules | ||
| date: 2025-06-09T18:00:00Z | ||
| --- | ||
|
|
||
| [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. | ||
|
|
||
| **What’s new:** | ||
| - You can now upload error pages and error assets that return error status codes (e.g. 403, 500, 502, 503, 504) when fetched | ||
| - 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 | ||
pedrosousa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| This is especially useful for retrieving error content or downtime banners from your backend when you can’t override the origin status code. | ||
|
|
||
| Learn more in the [Custom Errors](/rules/custom-errors/) documentation. | ||
39 changes: 39 additions & 0 deletions
39
src/content/changelog/rules/2025-06-09-transform-rule-subrequest-matching.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,39 @@ | ||
| --- | ||
| title: Match Workers subrequests by upstream zone — cf.worker.upstream_zone now supported in Transform Rules | ||
| description: Transform Rules now support the cf.worker.upstream_zone field, letting you conditionally apply rules based on which zone sent Workers subrequest. | ||
| products: | ||
| - rules | ||
| date: 2025-06-09T17:00:00Z | ||
| --- | ||
|
|
||
| import { Example } from "~/components"; | ||
|
|
||
| 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. | ||
pedrosousa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|  | ||
|
|
||
| **What's new:** | ||
| - `cf.worker.upstream_zone` is now supported in Transform Rules expressions. | ||
| - Skip or apply logic conditionally when handling [Workers subrequests](/workers/platform/limits/#subrequests). | ||
|
|
||
| For example, to add a header when the subrequest comes from another zone: | ||
|
|
||
| <Example> | ||
|
|
||
| Text in **Expression Editor** *(replace `myzone.com` with your domain)*: | ||
pedrosousa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```txt | ||
| (cf.worker.upstream_zone != "" and cf.worker.upstream_zone != "myzone.com") | ||
pedrosousa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| Selected operation under **Modify request header**: _Set static_ | ||
|
|
||
| **Header name**: `X-External-Workers-Subrequest` | ||
|
|
||
| **Value**: `1` | ||
|
|
||
| </Example> | ||
|
|
||
| This gives you more granular control in how you handle incoming requests for your zone. | ||
|
|
||
| Learn more in the [Transform Rules](/rules/transform/) documentation and [Rules language fields](/ruleset-engine/rules-language/fields/reference/) reference. | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.