filterCollection is the building block for non trivial rule files. Once you start writing rules that target specific combinations of host, method, headers and content type, this is the filter that ties everything together.
Use filterCollection whenever a single filter is not specific enough. It is the boolean composition primitive in Fluxzy rules. The collection has two combination modes:
and selects exchanges that satisfy every child filter, useful for narrow targeting such as "POST to api.example.com over HTTPS".or selects exchanges that satisfy at least one child filter, useful for grouping equivalent matches such as "any image or font response".The filter evaluates on the onAuthorityReceived scope, but the actual triggering moment is governed by the children, the collection lifts to the latest scope required by its children. Set inverted: true to take the logical complement of the combined result.
Apply a rate limiting throttle only to POST requests to the orders API, leaving GETs and other hosts untouched.
rules:
- filter:
typeKind: FilterCollection
operation: and
children:
- typeKind: HostFilter
pattern: orders.example.com
operation: Exact
- typeKind: PostFilter
actions:
- typeKind: AverageThrottleAction
bandwidthBytesPerSeconds: 16000
Group three asset filters under OR semantics so a single rule covers stylesheets, fonts and images for a static asset audit.
rules:
- filter:
typeKind: FilterCollection
operation: or
children:
- typeKind: CssStyleFilter
- typeKind: FontFilter
- typeKind: ImageFilter
actions:
- typeKind: ApplyTagAction
tag:
value: static-asset
Reject every DELETE request to the API that does not carry an Authorization header, by combining a method filter with an inverted authorization check.
rules:
- filter:
typeKind: FilterCollection
operation: and
children:
- typeKind: HostFilter
pattern: api.example.com
operation: Exact
- typeKind: DeleteFilter
- typeKind: HasAuthorizationFilter
inverted: true
actions:
- typeKind: RejectWithStatusCodeAction
statusCode: 401
FilterCollection is a combination of multiple filters with a merging operator (OR / AND).
Evaluation scope defines the timing where this filter will be applied.
onAuthorityReceived This scope denotes the moment fluxzy is aware the destination authority. In a regular proxy connection, it will occur the moment where fluxzy parsed the CONNECT request.
filterCollection
The following table describes the customizable properties available for this filter:
| Property | Type | Description | DefaultValue |
|---|---|---|---|
| children | array of filters | Children filters | [] |
| operation | or | and | Condition evaluation | or |
| inverted | boolean | Negate the filter result | false |
The following examples apply a comment to the filtered exchange
Retains exchanges having POST as method OR request to the host example.com.
rules:
- filter:
typeKind: FilterCollection
children:
- typeKind: PostFilter
- typeKind: HostFilter
pattern: example.com
operation: Exact
actions:
- typeKind: ApplyCommentAction
comment: filter was applied
View definition of FilterCollection for .NET integration.
This filter has no related filter
Yes. Nesting is supported and is the standard way to express arbitrarily complex boolean expressions such as (A AND B) OR (C AND D).
The collection itself declares onAuthorityReceived, but the effective triggering scope is the latest scope among its children. A collection that contains a response side filter will only fire once the response headers are available.
It negates the combined result. An inverted AND collection matches when any child does not match, an inverted OR collection matches when none of the children match.
Yes. Children are evaluated in order and Fluxzy stops as soon as the outcome of the boolean expression is known.