statusCodeSuccessFilter is the concise way to scope a Fluxzy rule to happy path traffic. Combine it with response side actions such as header rewrites or HTML injection to apply changes only when the upstream actually succeeded.
Use statusCodeSuccessFilter when you want a rule that applies only to successful responses. Restricting an action to the happy path is a common safety measure when the action would be inappropriate or noisy on error responses.
Typical situations:
The filter evaluates on the responseHeaderReceivedFromRemote scope. Use statusCodeFilter if you need to match a specific code such as 200 or 204, or pair this filter with a content type filter to narrow the scope further.
Apply a tag to any 2XX response so the happy path can be filtered in the timeline without manually selecting codes.
rules:
- filter:
typeKind: StatusCodeSuccessFilter
actions:
- typeKind: ApplyTagAction
tag:
value: success
Remove the Cache-Control header from 2XX responses in a test environment so the client always re fetches the resource.
rules:
- filter:
typeKind: StatusCodeSuccessFilter
actions:
- typeKind: DeleteResponseHeaderAction
headerName: Cache-Control
Combine the success filter with an HTML response filter inside a filterCollection so the banner only appears on real pages, not on error or redirect bodies.
rules:
- filter:
typeKind: FilterCollection
children:
- typeKind: StatusCodeSuccessFilter
- typeKind: HtmlResponseFilter
operation: And
actions:
- typeKind: InjectHtmlTagAction
tag: '<div style="position:fixed;top:0;left:0;background:#ffeb3b;padding:4px;">Fluxzy debugging session</div>'
Select exchanges that HTTP status code indicates a successful request (2XX).
Evaluation scope defines the timing where this filter will be applied.
responseHeaderReceivedFromRemote This scope occurs the moment fluxzy has done parsing the response header.
statusCodeSuccessFilter
This filter has no specific characteristic
The following table describes the customizable properties available for this filter:
| Property | Type | Description | DefaultValue |
|---|---|---|---|
| inverted | boolean | Negate the filter result | false |
The following examples apply a comment to the filtered exchange
Select exchanges that HTTP status code indicates a successful request (2XX).
rules:
- filter:
typeKind: StatusCodeSuccessFilter
actions:
- typeKind: ApplyCommentAction
comment: filter was applied
View definition of StatusCodeSuccessFilter for .NET integration.
The following filters are related to this filter:
Every status code in the 200 to 299 range, including 200, 201, 204 and 206 plus any non standard 2XX returned by an intermediary.
statusCodeFilter requires an explicit list of codes. statusCodeSuccessFilter is a class shortcut that always covers the whole 2XX range.
Yes. 204 is part of the 2XX class, so the filter matches even when the response carries no body.
Yes, set inverted: true. The rule then matches every response that is not in the 2XX range.