Rules changelog·续1
To get the most out of these fields, upload your client CA certificate to Cloudflare so that Cloudflare validates the client certificate at the edge and populates cf.tls_client_auth.cert_verified and cf.tls_client_auth.cert_revoked.
Prevent header injection
You should ensure that Client-Cert and Client-Cert-Chain headers received by your origin server can only originate from this transform rule — any client could send these headers directly.
- If you use WAF custom rules to block requests with invalid mTLS connections: The transform rule is sufficient. For all requests that reach your origin server, the rule will overwrite any existing
Client-CertandClient-Cert-Chainheaders. - If you do not enforce mTLS at the WAF: Add another transform rule that removes any incoming
Client-CertandClient-Cert-Chainheaders from all requests (use expressiontrue), ordered before the rule above. This ensures your origin server cannot receive client-supplied values for these HTTP headers.
For more information, refer to Mutual TLS authentication, Request Header Transform Rules, and the fields reference.
2026-03-18
Worker execution timing field now available in Rules
The cf.timings.worker_msec field is now available in the Ruleset Engine. This field reports the wall-clock time that a Cloudflare Worker spent handling a request, measured in milliseconds.
You can use this field to identify slow Worker executions, detect performance regressions, or build rules that respond differently based on Worker processing time, such as logging requests that exceed a latency threshold.
Field details
| Field | Type | Description |
|---|---|---|
cf.timings.worker_msec |
Integer | The time spent executing a Cloudflare Worker in milliseconds. Returns 0 if no Worker was invoked. |
Example filter expression:
cf.timings.worker_msec > 500
For more information, refer to the Fields reference.
2026-01-27
Control request and response body buffering in Configuration Rules
You can now control how Cloudflare buffers HTTP request and response bodies using two new settings in Configuration Rules.
Request body buffering
Controls how Cloudflare buffers HTTP request bodies before forwarding them to your origin server:
| Mode | Behavior |
|---|---|
| Standard (default) | Cloudflare can inspect a prefix of the request body for enabled functionality such as WAF and Bot Management. |
| Full | Buffers the entire request body before sending to origin. |
| None | No buffering — the request body streams directly to origin without inspection. |
Response body buffering
Controls how Cloudflare buffers HTTP response bodies before forwarding them to the client:
| Mode | Behavior |
|---|---|
| Standard (default) | Cloudflare can inspect a prefix of the response body for enabled functionality. |
| None | No buffering — the response body streams directly to the client without inspection. |
Caution
Setting body buffering to None may break security functionality that requires body inspection, including the Web Application Firewall (WAF) and Bot Management. Ensure that any paths where you disable buffering do not require security inspection.
API example
{
"action": "set_config",
"action_parameters": {
"request_body_buffering": "standard",
"response_body_buffering": "none"
}
}
For more information, refer to Configuration Rules.
2026-01-22
New cryptographic functions — encode_base64() and sha256()
Cloudflare Rulesets now includes encode_base64() and sha256() functions, enabling you to generate signed request headers directly in rule expressions. These functions support common patterns like constructing a canonical string from request attributes, computing a SHA256 digest, and Base64-encoding the result.
New functions
| Function | Description | Availability |
|---|---|---|
encode_base64(input, flags) |
Encodes a string to Base64 format. Optional flags parameter: u for URL-safe encoding, p for padding (adds = characters to make the output length a multiple of 4, as required by some systems). By default, output is standard Base64 without padding. |
All plans (in header transform rules) |
sha256(input) |
Computes a SHA256 hash of the input string. | Requires enablement |
Note
The sha256() function is available as an Enterprise add-on and requires a specific entitlement. Contact your account team to enable it.
Examples
Encode a string to Base64 format:
encode_base64("hello world")
Returns: aGVsbG8gd29ybGQ
Encode a string to Base64 format with padding:
encode_base64("hello world", "p")
Returns: aGVsbG8gd29ybGQ=
Perform a URL-safe Base64 encoding of a string:
encode_base64("hello world", "u")
Returns: aGVsbG8gd29ybGQ
Compute the SHA256 hash of a secret token:
sha256("my-token")
Returns a hash that your origin can validate to authenticate requests.
Compute the SHA256 hash of a string and encode the result to Base64 format:
encode_base64(sha256("my-token"))
Combines hashing and encoding for systems that expect Base64-encoded signatures.
For more information, refer to the Functions reference.
2026-01-20
New functions for array and map operations
New functions for array and map operations
Cloudflare Rulesets now include new functions that enable advanced expression logic for evaluating arrays and maps. These functions allow you to build rules that match against lists of values in request or response headers, enabling use cases like country-based blocking using custom headers.
New functions
| Function | Description |
|---|---|
split(source, delimiter) |
Splits a string into an array of strings using the specified delimiter. |
join(array, delimiter) |
Joins an array of strings into a single string using the specified delimiter. |
has_key(map, key) |
Returns true if the specified key exists in the map. |
has_value(map, value) |
Returns true if the specified value exists in the map. |
Example use cases
Check if a country code exists in a header list:
has_value(split(http.response.headers["x-allow-country"][0], ","), ip.src.country)
Check if a specific header key exists:
has_key(http.request.headers, "x-custom-header")
Join array values for logging or comparison:
join(http.request.headers.names, ", ")
For more information, refer to the Functions reference.
2026-01-12
Metro code field now available in Rules
The ip.src.metro_code field in the Ruleset Engine is now populated with DMA (Designated Market Area) data.
You can use this field to build rules that target traffic based on geographic market areas, enabling more granular location-based policies for your applications.
Field details
| Field | Type | Description |
|---|---|---|
ip.src.metro_code |
String | null | The metro code (DMA) of the incoming request's IP address. Returns the designated market area code for the client's location. |
Example filter expression:
ip.src.metro_code eq "501"
For more information, refer to the Fields reference.
2025-10-30
New TCP-based fields available in Rulesets
Build rules based on TCP transport and latency
Cloudflare now provides two new request fields in the Ruleset engine that let you make decisions based on whether a request used TCP and the measured TCP round-trip time between the client and Cloudflare. These fields help you understand protocol usage across your traffic and build policies that respond to network performance. For example, you can distinguish TCP from QUIC traffic or route high latency requests to alternative origins when needed.
New fields
| Field | Type | Description |
|---|---|---|
cf.edge.client_tcp |
Boolean | Indicates whether the request used TCP. A value of true means the client connected using TCP instead of QUIC. |
cf.timings.client_tcp_rtt_msec |
Number | Reports the smoothed TCP round-trip time between the client and Cloudflare in milliseconds. For example, a value of 20 indicates roughly twenty milliseconds of RTT. |
Example filter expression:
cf.edge.client_tcp && cf.timings.client_tcp_rtt_msec < 100
More information can be found in the Rules language fields reference.
2025-06-09
More flexible fallback handling — Custom Errors now support fetching assets returned with 4xx or 5xx status codes
Custom Errors can now fetch and store assets and 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 (for example, 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.
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 documentation.
2025-06-09
Match Workers subrequests by upstream zone — cf.worker.upstream_zone now supported in Transform Rules
You can now use the cf.worker.upstream_zone field in Transform Rules to control rule execution based on whether a request originates from Workers, including subrequests issued by Workers in other zones.

What's new:
cf.worker.upstream_zoneis now supported in Transform Rules expressions.- Skip or apply logic conditionally when handling Workers subrequests.
For example, to add a header when the subrequest comes from another zone:
Text in Expression Editor (replace myappexample.com with your domain):
(cf.worker.upstream_zone != "" and cf.worker.upstream_zone != "myappexample.com")
Selected operation under Modify request header: Set static
Header name: X-External-Workers-Subrequest
Value: 1
This gives you more granular control in how you handle incoming requests for your zone.
Learn more in the Transform Rules documentation and Rules language fields reference.
2025-05-30
Fine-tune image optimization — WebP now supported in Configuration Rules
You can now enable Polish with the webp format directly in Configuration Rules, allowing you to optimize image delivery for specific routes, user agents, or A/B tests — without applying changes zone-wide.
What’s new:
This gives you more precise control over how images are compressed and delivered, whether you're targeting modern browsers, running experiments, or tailoring performance by geography or device type.
Learn more in the Polish and Configuration Rules documentation.
2025-05-09
More ways to match — Snippets now support Custom Lists, Bot Score, and WAF Attack Score
You can now use IP, Autonomous System (AS), and Hostname custom lists to route traffic to Snippets and Cloud Connector, giving you greater precision and control over how you match and process requests at the edge.
In Snippets, you can now also match on Bot Score and WAF Attack Score, unlocking smarter edge logic for everything from request filtering and mitigation to tarpitting and logging.
What’s new:
- Custom lists matching – Snippets and Cloud Connector now support user-created IP, AS, and Hostname lists via dashboard or Lists API. Great for shared logic across zones.
- Bot Score and WAF Attack Score – Use Cloudflare’s intelligent traffic signals to detect bots or attacks and take advanced, tailored actions with just a few lines of code.

These enhancements unlock new possibilities for building smarter traffic workflows with minimal code and maximum efficiency.
Learn more in the Snippets and Cloud Connector documentation.
2025-04-24
Custom Errors are now Generally Available
Custom Errors are now generally available for all paid plans — bringing a unified and powerful experience for customizing error responses at both the zone and account levels.
You can now manage Custom Error Rules, Custom Error Assets, and redesigned Error Pages directly from the Cloudflare dashboard. These features let you deliver tailored messaging when errors occur, helping you maintain brand consistency and improve user experience — whether it’s a 404 from your origin or a security challenge from Cloudflare.
What's new:
- Custom Errors are now GA – Available on all paid plans and ready for production traffic.
- UI for Custom Error Rules and Assets – Manage your zone-level rules from the Rules > Overview and your zone-level assets from the Rules > Settings tabs.
- Define inline content or upload assets – Create custom responses directly in the rule builder, upload new or reuse previously stored assets.
- Refreshed UI and new name for Error Pages – Formerly known as “Custom Pages,” Error Pages now offer a cleaner, more intuitive experience for both zone and account-level configurations.
- Powered by Ruleset Engine – Custom Error Rules support conditional logic and override Error Pages for 500 and 1000 class errors, as well as errors originating from your origin or other Cloudflare products. You can also configure Response Header Transform Rules to add, change, or remove HTTP headers from responses returned by Custom Error Rules.
Learn more in the Custom Errors documentation.
2025-04-09
Cloudflare Snippets are now Generally Available

