Skip to content

Commit 921d850

Browse files
pedrosousathomasgauvin
authored andcommitted
[Rules] Update available fields (#24204)
1 parent de0f765 commit 921d850

File tree

3 files changed

+42
-4
lines changed

3 files changed

+42
-4
lines changed

src/content/docs/rules/transform/request-header-modification/reference/fields-functions.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ import { Render } from "~/components";
1212

1313
The available fields when setting an HTTP request header value using an expression are the following:
1414

15-
<Render file="transform/header-modification-fields" />
15+
<Render file="transform/header-modification-fields" params={{ location: "request" }} />
1616

1717
For information on the available functions, refer to [Functions](/ruleset-engine/rules-language/functions/).

src/content/docs/rules/transform/response-header-modification/reference/fields-functions.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ import { Render } from "~/components";
1212

1313
The available fields when setting an HTTP response header value using an expression are the following:
1414

15-
<Render file="transform/header-modification-fields" />
15+
<Render file="transform/header-modification-fields" params={{ location: "response" }} />
1616

1717
For information on the available functions, refer to [Functions](/ruleset-engine/rules-language/functions/).

src/content/partials/rules/transform/header-modification-fields.mdx

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
---
2-
{}
2+
params:
3+
- location
34
---
45

6+
import { Markdown } from "~/components";
7+
58
- `cf.bot_management.*`
69
- `cf.client.bot`
710
- `cf.threat_score`
11+
- `cf.verified_bot_category`
812
- `cf.edge.server_ip`
913
- `cf.edge.server_port`
1014
- `cf.edge.client_port`
@@ -16,6 +20,7 @@
1620
- `http.host`
1721
- `http.referer`
1822
- `http.request.headers`
23+
- `http.request.headers.*`
1924
- `http.request.accepted_languages`
2025
- `http.request.method`
2126
- `http.request.timestamp.sec`
@@ -26,6 +31,9 @@
2631
- `http.request.version`
2732
- `raw.http.request.full_uri`
2833
- `raw.http.request.uri`
34+
- `raw.http.request.uri.*`
35+
- `raw.http.request.headers`
36+
- `raw.http.request.headers.*`
2937
- `http.user_agent`
3038
- `http.x_forwarded_for`
3139
- `ip.src`
@@ -35,16 +43,46 @@
3543
- `ip.src.city`
3644
- `ip.src.country`
3745
- `ip.src.continent`
46+
- `ip.src.metro_code`
47+
- `ip.src.postal_code`
48+
- `ip.src.region`
49+
- `ip.src.region_code`
3850
- `ip.src.is_in_european_union`
3951
- `ip.src.subdivision_1_iso_code`
4052
- `ip.src.subdivision_2_iso_code`
4153
- `ssl`
4254

55+
{ props.location === "request" && (
56+
<>
57+
<ul>
58+
<li><code>http.request.jwt.claims</code></li>
59+
<li><code>http.request.jwt.claims.*</code></li>
60+
<li><code>cf.waf.auth_detected</code></li>
61+
<li><code>cf.waf.credential_check.*</code></li>
62+
<li><code>cf.waf.score</code></li>
63+
<li><code>cf.waf.score.*</code></li>
64+
</ul>
65+
</>
66+
)}
67+
68+
{ props.location === "response" && (
69+
<>
70+
<ul>
71+
<li><code>http.response.code</code></li>
72+
<li><code>http.response.headers</code></li>
73+
<li><code>http.response.headers.*</code></li>
74+
<li><code>http.response.content_type.media_type</code></li>
75+
<li><code>cf.response.1xxx_code</code></li>
76+
<li><code>cf.response.error_type</code></li>
77+
</ul>
78+
</>
79+
)}
80+
4381
Refer to [Fields](/ruleset-engine/rules-language/fields/reference/) for reference information on these fields.
4482

4583
:::caution[Important]
4684

47-
- To obtain the value of an HTTP request header using the [`http.request.headers`](/ruleset-engine/rules-language/fields/reference/http.request.headers/) field, specify the header name in **lowercase**. For example, to get the first value of the `Accept-Encoding` request header in an expression, use: `http.request.headers["accept-encoding"][0]`.
85+
- To obtain the value of an HTTP header using the [`http.request.headers`](/ruleset-engine/rules-language/fields/reference/http.request.headers/) { props.location === "response" ? <Markdown text='or [`http.response.headers`](/ruleset-engine/rules-language/fields/reference/http.response.headers/) field'/> : 'field' }, specify the header name in **lowercase**. For example, to get the first value of the `Accept-Encoding` request header in an expression, use: `http.request.headers["accept-encoding"][0]`.
4886

4987
- Use the `to_string()` function to get the string representation of a non-string value like an Integer value. For example, `to_string(cf.bot_management.score)`.
5088

0 commit comments

Comments
 (0)