methodFilter is the general purpose verb selector for Fluxzy rules, with full support for exact, prefix, suffix, contains and regex matching. Use it when the dedicated verb filters do not cover your need (custom methods, WebDAV verbs, regex matches) and pair it with any action below to act on the selected traffic.
Reach for methodFilter when you want to scope a rule by the HTTP verb of the incoming request. It is the most general method based selector and covers any verb including non standard ones like PROPFIND, MKCOL, or anything your application invents.
Typical situations:
TRACE or OPTIONS requests for security audits.The filter evaluates on the requestHeaderReceivedFromClient scope, so the method is available as soon as the request line is parsed. For common verbs you can also use the dedicated getFilter, postFilter, putFilter, deleteFilter or patchFilter, which are slightly more readable.
Reject every TRACE request reaching the proxy. TRACE can echo sensitive headers back and is rarely needed in production traffic.
rules:
- filter:
typeKind: MethodFilter
pattern: TRACE
operation: Exact
actions:
- typeKind: RejectWithStatusCodeAction
statusCode: 405
Mark every WebDAV style request (PROPFIND, MKCOL, COPY, MOVE, LOCK, UNLOCK) so you can find them in the capture view without listing each verb manually.
rules:
- filter:
typeKind: MethodFilter
pattern: ^(PROPFIND|MKCOL|COPY|MOVE|LOCK|UNLOCK)$
operation: Regex
actions:
- typeKind: ApplyTagAction
tag:
value: webdav
Annotate every CORS preflight (OPTIONS) request so you can quickly identify them during a debugging session.
rules:
- filter:
typeKind: MethodFilter
pattern: OPTIONS
operation: Exact
actions:
- typeKind: ApplyCommentAction
comment: "cors preflight"
Select exchanges according to request method.
Evaluation scope defines the timing where this filter will be applied.
requestHeaderReceivedFromClient This scope occurs the moment fluxzy parsed the request header receiveid from client
methodFilter
The following table describes the customizable properties available for this filter:
| Property | Type | Description | DefaultValue |
|---|---|---|---|
| pattern | string | The string pattern to search | |
| operation | exact | contains | startsWith | endsWith | regex | The search operation performed | exact |
| caseSensitive | boolean | true if the Search should be case sensitive | false |
| inverted | boolean | Negate the filter result | false |
The following examples apply a comment to the filtered exchange
Select exchanges having TRACE request method.
rules:
- filter:
typeKind: MethodFilter
pattern: TRACE
operation: Exact
actions:
- typeKind: ApplyCommentAction
comment: filter was applied
View definition of MethodFilter for .NET integration.
The following filters are related to this filter:
getFilter, postFilter, putFilter, deleteFilter and patchFilter are convenience wrappers around methodFilter with the verb fixed. Use them for the five common verbs to keep your rule files concise, and use methodFilter for anything custom or for regex matches.
No by default. HTTP methods are case sensitive on the wire but most clients send them uppercase. methodFilter is case insensitive unless you set caseSensitive to true.
Yes. Use the Regex operation with a pattern like ^(POST|PUT|PATCH)$ to match any write style verb. Alternatively, group several methodFilter instances inside a FilterCollection.
Both, because methodFilter evaluates at requestHeaderReceivedFromClient and the verb is not rewritten before that scope. If you change the method with changeRequestMethodAction, the filter still sees the original value.