Configuration reference
The Traffic Policy configuration reference for this action.Supported phases
on_http_request
Type
request-body-find-replace
Configuration fields
Array of replacement rules to apply to the request body. Rules are applied in order.Minimum
1 replacement required.Regular expression pattern to match. Supports RE2 syntax.
CEL interpolation is supported for dynamic patterns.
Replacement string. Use
$1, $2, etc. to reference capture groups from the pattern.
CEL interpolation is supported for dynamic replacements.
If omitted or empty, matched text is deleted.Behavior
When this action executes, it buffers the entire request body, applies all replacement rules in order, and updates theContent-Length header if present.
Pattern matching
Thefrom field accepts RE2 regular expressions.
All matches in the body are replaced, not just the first occurrence.
Capture groups
You can use capture groups in your pattern and reference them in the replacement:CEL expressions
Bothfrom and to fields support CEL interpolation for dynamic values:
from field, the resulting string must be a valid regular expression.
Content-Length handling
After replacements are applied, the action automatically updates theContent-Length
header to reflect the new body size.
Ordering
Replacement rules are applied in the order they are specified. Later rules operate on the result of earlier rules.Examples
Redacting sensitive data from requests
The following configuration redacts API keys and email addresses from request bodies.Example Traffic Policy document
Example request
Before (original request body):Modifying AI prompts
Add system instructions to AI model requests:Removing unwanted content
Delete specific patterns by using an emptyto value:
Action result variables
The following variables are made available for use in subsequent expressions and CEL interpolations after the action has run. Variable values will only apply to the last action execution, results are not concatenated.Related actions
- Response Body Find & Replace - Modify response bodies
- SSE Find & Replace - Modify Server-Sent Events streams