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

methodFilter Filter

Select exchanges by their HTTP request method, with exact, prefix, suffix, contains or regex matching for any verb including custom ones.

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.

When to use this filter

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:

  • Selecting TRACE or OPTIONS requests for security audits.
  • Targeting a custom verb used by a WebDAV or CalDAV service.
  • Combining a verb match with a path filter to scope a rule to a specific endpoint and action.

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.

Real world examples

Block TRACE requests for security

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

Tag WebDAV verbs with a regex

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

Apply a comment to OPTIONS preflight requests

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"

Reference

methodFilter

Description

Select exchanges according to request method.

Evaluation scope

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

YAML configuration name

methodFilter

Settings

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

Example of usage

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

.NET reference

View definition of MethodFilter for .NET integration.

See also

The following filters are related to this filter:

Frequently asked questions

How does methodFilter compare with getFilter or postFilter?

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.

Is the method comparison case sensitive?

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.

Can I match several verbs at once?

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.

Does it match the verb sent by the client or the one forwarded to the upstream?

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.

Learn more about Fluxzy rules