New Transparent capture is in preview. Record every app's traffic with no proxy configuration, on Windows, macOS and Linux. Learn more

filterCollection Filter

Group several filters with an AND or OR operator to build precise selectors that target exactly the exchanges you care about.

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.

When to use this filter

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.

Real world examples

Target POST requests to a specific host

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

Tag any static asset regardless of type

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

Block unauthenticated DELETE traffic to the API

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

Reference

filterCollection

Description

FilterCollection is a combination of multiple filters with a merging operator (OR / AND).

Evaluation scope

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.

YAML configuration name

filterCollection

Settings

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

Example of usage

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

.NET reference

View definition of FilterCollection for .NET integration.

See also

This filter has no related filter

Frequently asked questions

Can I nest filterCollection inside another filterCollection?

Yes. Nesting is supported and is the standard way to express arbitrarily complex boolean expressions such as (A AND B) OR (C AND D).

Which scope does the collection use?

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.

What does inverted do here?

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.

Is short circuit evaluation guaranteed?

Yes. Children are evaluated in order and Fluxzy stops as soon as the outcome of the boolean expression is known.

Learn more about Fluxzy rules