Skip to content

Filters ​

When matching based on request or response attributes (not just the URL), you can use filters to achieve more granular rule control. The syntax is:

txt
pattern operator includeFilter://pattern1 ... excludeFilter://patternx ...

Multiple filters are matched "or"; as long as one of the filter conditions matches, the match is true.

Filter Types ​

Filter TypeSyntaxPurpose
Include FilterincludeFilter://patternMatch only requests that match the specified conditions
Exclude FilterexcludeFilter://patternExclude requests that match the specified conditions

Pattern Types ​

Match expressions used with includeFilter://<pattern> and excludeFilter://<pattern>.

General rules

  • When no prefix is specified, the request URL is matched by default.
  • Keyword matching is case-insensitive by default.
  • Regex format is /regexp/; append i at the end to ignore case, e.g. /regexp/i.
  • The probability value for chance ranges from 0 to 1.
SyntaxMatch targetExample
b:patternRequest body content: keyword (case-insensitive) or regexincludeFilter://b:keyword
excludeFilter://b:/regexp/i
m:patternHTTP method: method name (case-insensitive) or regexincludeFilter://m:get
excludeFilter://m:/regexp/i
i:patternClient or server IP: IP or regexincludeFilter://i:192.168.1.10
excludeFilter://i:/regexp/i
chance:probabilityRandom hit by probability: Math.random() < probabilityincludeFilter://chance:0.5
excludeFilter://chance:0.3
clientIp:patternClient IP: IP or regexincludeFilter://clientIp:192.168.1.10
excludeFilter://clientIp:/regexp/i
serverIp:patternServer IP: IP or regexincludeFilter://serverIp:192.168.1.10
excludeFilter://serverIp:/regexp/i
s:patternResponse status code: status code or regexincludeFilter://s:/^20/
excludeFilter://s:200
reqH.header-key:patternRequest header: keyword (case-insensitive) or regexincludeFilter://reqH.content-type:json
excludeFilter://reqH.content-type:/regexp/i
resH.header-key:patternResponse header: keyword (case-insensitive) or regexincludeFilter://resH.content-type:json
excludeFilter://resH.content-type:/regexp/i
No-prefix pattern (any other xxxxxx)Request URL, same as patternincludeFilter://*/cgi-*
excludeFilter://www.test.com
includeFilter://https://www.test.com/path