Fields
The Cloudflare Firewall Rules language supports a range of field types:
- Standard fields represent common, typically static properties of an HTTP request.
- Dynamic fields represent computed or derived values, typically related to Cloudflare threat intelligence about the request.
- URI argument and value fields are extracted from the request.
- HTTP header fields represent the names and values associated with HTTP request headers.
- HTTP body fields represent the properties of an HTTP request body, including forms, for example.
Standard fields
Most standard fields use the same naming conventions as Wireshark display fields. However, there are some subtle differences between Cloudflare and Wireshark:
Wireshark supports CIDR (Classless Inter-Domain Routing) notation for expressing IP address ranges in equality comparisons (
ip.src == 1.2.3.0/24
, for example). Cloudflare does not.To evaluate a range of addresses using CIDR notation, use the
in
comparison operator as in this example:ip.src in {1.2.3.0/24 4.5.6.0/24}
.In Wireshark,
ssl
is a protocol field containing hundreds of other fields of various types that are available for comparison in multiple ways. However, in Firewall Rulesssl
is a single Boolean field that indicates whether the connection from the client to Cloudflare is encrypted.The Cloudflare Firewall Rules language does not support the
slice
operator.
The Cloudflare Firewall Rules language supports these standard fields:
Field | Description |
---|---|
http.cookie String | The entire cookie as a string. Example value: |
http.host String | The host name used in the full request URI. Example value: |
http.referer String | The HTTP Referer request header, which contains the address of the web page that linked to the currently requested page. Example value: |
http.request.full_uri String | The full URI as received by the web server (does not include Example value: |
http.request.method String | The HTTP method, returned as a string of uppercase characters. Example value: |
http.request.timestamp.sec Integer | The timestamp when Cloudflare received the request, expressed as Unix time in seconds. This value is 10 digits long. Example value: When validating HMAC tokens in an expression, pass this field as the currentTimestamp argument to the |
http.request.uri String | The absolute URI of the request. Example value: |
http.request.uri.path String | The URI path of the request. Example value: |
http.request.uri.query String | The entire query string, without the Example value: |
http.user_agent String | The HTTP user agent, a request header that contains a characteristic string to allow identification of the client operating system and web browser. Example value: |
http.request.version Number | The version of the HTTP protocol. Use this field when you require different checks for different versions. Example Values:
|
http.x_forwarded_for String | The full Example value: |
ip.src IP address | The client TCP IP address, which may be adjusted to reflect the actual address of the client by using, for example, HTTP headers such as Example value: |
ip.geoip.asnum Number | The 16- or 32-bit integer representing the Autonomous System (AS) number associated with client IP address. |
ip.geoip.continent String | The continent code associated with client IP address:
|
ip.geoip.country String | The 2-letter country code in ISO 3166-1 Alpha 2 format. Example value: |
ip.geoip.subdivision_1_iso_code String | The ISO 3166-2 code for the first-level subdivision associated with the IP address. When the actual value is not available, this field contains an empty string. Example value: |
ip.geoip.subdivision_2_iso_code String | The ISO 3166-2 code for the second-level region associated with the IP address. When the actual value is not available, this field contains an empty string. Example value: |
ip.geoip.is_in_european_union Boolean | When |
ssl Boolean | When |
Dynamic fields
Dynamic fields represent computed or derived values, typically related to threat intelligence about an HTTP request.
The Cloudflare Firewall Rules language supports these dynamic fields:
Field Name | Description |
---|---|
| When |
| The likelihood that a request originated from a bot using a score from 1–99. A low score indicates that the request comes from a bot or an automated agent. A high score indicates that a human issued the request. |
cf.client.bot Boolean | When |
cf.edge.server_port Number | The port number at which Cloudflare's network received the request. Use this field to filter traffic on a specific port. The value is a port number in the range 1–65535. |
cf.threat_score Number | A Cloudflare threat score from 0–100, where 0 indicates low risk. Values above 10 may represent spammers or bots, and values above 40 identify bad actors on the internet. It is rare to see values above 60. A common recommendation is to challenge requests with a score above 10 and to block those above 50. |
cf.tls_client_auth.cert_verified Boolean | When true , this field indicates the request includes a valid client certificate. |
cf.worker.upstream_zone String | Identifies whether a request comes from a worker. When a request comes from a worker, this field will hold the name of the zone for that worker. Otherwise |
URI argument and value fields
The Cloudflare Firewall Rules language includes URI argument and value fields associated with HTTP requests. Many of these fields return arrays containing the respective values. Those that do require the [*]
index operator, which returns an array of values for each field.
The Cloudflare Firewall Rules language supports these URI argument and value fields:
Field Name | Description |
http.request.uri.args Map<String><Array> | The HTTP URI arguments associated with a request as a Map (associative array). When an argument repeats, then the array contains multiple items in the order they appear in the request. Values are not pre-processed and retain the case used in the request. Decoding: no decoding performed Example: Example value: |
http.request.uri.args.names Array<String> | The names of the arguments in the HTTP URI query string. Names are not pre-processed and retain the case used in the request. When a name repeats, the array contains multiple items in the order that they appear in the request. Decoding: no decoding performed Example: Example value: |
http.request.uri.args.values Array<String> | The values of arguments in the HTTP URI query string. Values are not pre-processed and retain the case used in the request. They are in the same order as in the request. Duplicated values are listed multiple times. Decoding: no decoding performed Example: Example value: |
HTTP header fields
The Firewall Rules language includes fields that represent properties of HTTP request headers. Many of these return arrays containing the respective values. Those that do require the [*]
index operator, which returns an array of values for each field.
The Cloudflare Firewall Rules language supports these HTTP header fields:
Field Name | Description |
http.request.headers Map<String><Array> | Represents HTTP request headers as a Map (or associative array). When there are repeating headers, the array includes them in the order they appear in the request. The keys convert to lowercase. Decoding: no decoding performed Example: Example value: |
http.request.headers.names Array<String> | The names of the headers in the HTTP request. The names are not pre-processed and retain the case used in the request. The order of header names is not guaranteed but will match Duplicate headers are listed multiple times. Decoding: no decoding performed Example: Example value: |
http.request.headers.values Array<String> | The values of the headers in the HTTP request. Values are not pre-processed and retain the case used in the request. The order of header values is not guaranteed but will match Duplicate headers are listed multiple times. Decoding: no decoding performed Example 1: Example value 1: Additionally used for logging requests according to the specified operator and the length/size entered for the header value. Example 2: Example value 2: |
http.request.headers.truncated Boolean | When When |
HTTP body fields
The Firewall Rules language includes fields that represent properties of an HTTP request body. Many of these return arrays containing the respective values. Those that do require the [*]
index operator, which returns an array of values for each field.
The Cloudflare Firewall Rules language supports these HTTP body fields:
Field Name | Description |
http.request.body.raw String | The unaltered HTTP request body. When the value of Decoding: no decoding performed |
http.request.body.truncated Boolean | Indicates whether the HTTP request body is truncated. When true, |
http.request.body.form Map<String><Array> | The HTTP request body of a form as a Map (or associative array). Populated when the Values are not pre-processed and retain the case used in the request. When a field repeats, then the array contains multiple items in the order they are in the request. The return value may be truncated if Decoding: no decoding performed Example: Example value: |
http.request.body.form.names Array<String> | The names of the form fields in an HTTP request where the content type is Names are not pre-processed and retain the case found in the request. They are listed in the same order as in the request. Duplicate names are listed multiple times. When Decoding: no decoding performed Example: Example value: |
http.request.body.form.values Array<String> | The values of the form fields in an HTTP request where the content type is Values are not pre-processed and retain the case used in the request. They are in the same order as in the request. Duplicated values are listed multiple times. The return value may be truncated if Decoding: no decoding performed Example: Example value: |