You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Takes a comma-separated list of values. Concatenates the argument values into a single String or array.
107
+
Takes a comma-separated list of values. Concatenates the argument values into a single String or array.
108
108
109
109
The return type depends on the type of input arguments. For example, if you concatenate arrays, the function will return an array.
110
110
@@ -121,7 +121,7 @@ Decodes a Base64-encoded String specified in `source`.
121
121
122
122
For example, with the following HTTP request header: `client_id: MTIzYWJj`, `(any(decode_base64(http.request.headers["client_id"][*])[*] eq "123abc"))` would return `true`.
123
123
124
-
:::caution
124
+
:::note
125
125
You can only use the `decode_base64()` function in [header transform rules](/rules/transform/), [custom rules](/waf/custom-rules/), and [rate limiting rules](/waf/rate-limiting-rules/).
126
126
:::
127
127
@@ -249,7 +249,7 @@ Examples:
249
249
250
250
Create capture groups by putting part of the regular expression in parentheses. Then, reference a capture group using `${<NUMBER>}` in the replacement string, where `<NUMBER>` is the number of the capture group.
251
251
252
-
:::caution
252
+
:::note
253
253
You can only use the `regex_replace()` function in rewrite expressions of [Transform Rules](/rules/transform/) and target URL expressions of [dynamic URL redirects](/rules/url-forwarding/single-redirects/).
254
254
:::
255
255
@@ -262,6 +262,43 @@ Returns a new byte array with all the occurrences of the given bytes removed.
262
262
263
263
For example, if `http.host` is `"www.cloudflare.com"`, then `remove_bytes(http.host, "\x2e\x77")` will return `"cloudflarecom"`.
Removes one or more query string parameters from a URI query string. Returns a string without the specified parameters.
271
+
272
+
The `field` must be one of the following:
273
+
274
+
-`http.request.uri.query`
275
+
-`raw.http.request.uri.query`
276
+
277
+
The `field` cannot be a literal value such as `"search=foo&order=asc"`.
278
+
279
+
The `remove_query_args()` function will remove all specified parameters (as `query_param1`, `query_param2`, etc.) , including repeated occurrences of the same parameter.
280
+
281
+
The ordering of unaffected query parameters will be preserved.
282
+
283
+
Examples:
284
+
285
+
```txt
286
+
// If http.request.uri.query is "order=asc&country=GB":
287
+
288
+
remove_query_args(http.request.uri.query, "country") will return "order=asc"
289
+
remove_query_args(http.request.uri.query, "order") will return "country=GB"
290
+
remove_query_args(http.request.uri.query, "search") will return "order=asc&country=GB" (unchanged)
291
+
292
+
// If http.request.uri.query is "category=Foo&order=desc&category=Bar":
293
+
294
+
remove_query_args(http.request.uri.query, "order") will return "category=Foo&category=Bar"
295
+
remove_query_args(http.request.uri.query, "category") will return "order=desc"
296
+
```
297
+
298
+
:::note
299
+
You can only use the `remove_query_args()` function in [rewrite expressions of Transform Rules](/rules/transform/).
300
+
:::
301
+
265
302
### `starts_with`
266
303
267
304
{/* prettier-ignore */}
@@ -308,7 +345,7 @@ to_string(cf.bot_management.score) will return "5"
308
345
to_string(ssl) will return "true"
309
346
```
310
347
311
-
:::caution
348
+
:::note
312
349
You can only use the `to_string()` function in rewrite expressions of [Transform Rules](/rules/transform/) and target URL expressions of [dynamic URL redirects](/rules/url-forwarding/single-redirects/).
313
350
:::
314
351
@@ -363,7 +400,7 @@ Generates a random UUIDv4 (Universally Unique Identifier, version 4) based on th
363
400
364
401
For example, `uuidv4(cf.random_seed)` will return a UUIDv4 similar to `49887398-6bcf-485f-8899-f15dbef4d1d5`.
365
402
366
-
:::caution
403
+
:::note
367
404
You can only use the `uuidv4()` function in [rewrite expressions of Transform Rules](/rules/transform/).
368
405
:::
369
406
@@ -408,7 +445,7 @@ Examples:
408
445
409
446
For more examples of wildcard matching, refer to [Wildcard matching](/ruleset-engine/rules-language/operators/#wildcard-matching).
410
447
411
-
:::caution
448
+
:::note
412
449
Currently, you can only use the `wildcard_replace()` function in rewrite expressions of [URL rewrites](/rules/transform/url-rewrite/) and target URL expressions of [dynamic URL redirects](/rules/url-forwarding/single-redirects/).
413
450
:::
414
451
@@ -453,27 +490,21 @@ is_timed_hmac_valid_v0(
453
490
The `is_timed_hmac_valid_v0()` function has these parameter definitions:
454
491
455
492
-`Key` <Typetext="String literal" />
456
-
457
493
- Specifies the secret cryptographic key for validating the HMAC.
458
494
459
495
-`MessageMAC` <Typetext="String" />
460
-
461
496
- Contains a concatenation of these HMAC elements: `message`, `separator`, `timestamp`, `mac`. For a definition and an example, refer to [MessageMAC](#messagemac).
462
497
463
498
-`ttl` <Typetext="Integer literal" />
464
-
465
499
- Defines the time-to-live for the HMAC token, expressed in seconds. Determines how long the token is valid, relative to the time it was issued.
466
500
467
501
-`currentTimeStamp` <Typetext="Integer" />
468
-
469
502
- Represents the UNIX timestamp when Cloudflare received the request, expressed in seconds. Pass the `http.request.timestamp.sec` field as an approximate value to this argument.
- Specifies the length of the `separator` between the `timestamp` and the `message` in the `MessageMAC`. Expressed in bytes, with a default value of `0`.
- When you set this optional argument to `'s'`, the function expects the value of the Base64-encoded `mac` in the `MessageMAC` argument to use the URL-safe character set with no padding.
478
509
479
510
- When you do **not** set the value of `flags` to `'s'`, you must URL encode the Base64 value for `mac` in the `MessageMAC` argument.
@@ -512,7 +543,7 @@ For details on generating a MessageMAC, refer to [HMAC token generation](/waf/cu
512
543
513
544
## HMAC validation examples
514
545
515
-
:::caution[Important]
546
+
:::note
516
547
517
548
When you do not use the optional `flags` argument for `is_timed_hmac_valid_v0()`, you must URL-encode the Base64 value for `mac` in the `MessageMAC` argument.
0 commit comments