Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add more infos to match conditions docs #288

Merged
merged 2 commits into from
Jan 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion website/docs/policies/match-conditions.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ You can define match conditions if you need fine-grained request filtering.

Match conditions are **CEL expressions**. All match conditions must evaluate to `true` for the request to be evaluated.

!!!info
eddycharly marked this conversation as resolved.
Show resolved Hide resolved

Match conditions have access to the same CEL variables as validation expressions.

## Example

```yaml
Expand All @@ -24,4 +28,13 @@ spec:
In the policy above, the `matchConditions` will be used to deny all requests having the `x-force-deny` header.

- If an incoming request doesn't have the `x-force-deny` header, then the condition will return `false` and the policy won't apply
- If an incoming request has the `x-force-deny` header, then the condition will return `true` and the `deny` rule will deny the request with status code `403`
- If an incoming request has the `x-force-deny` header, then the condition will return `true` and the `deny` rule will deny the request with status code `403`

## Error handling

In the event of an error evaluating a match condition the policy is not evaluated. Whether to reject the request is determined as follows:

1. If any match condition evaluated to `false` (regardless of other errors), then the policy is skipped.
1. Otherwise:
- for `failurePolicy: Fail`, reject the request (without evaluating the policy).
- for `failurePolicy: Ignore`, proceed with the request but skip the policy.
Loading