Match Conditions Reference

Last update:2026-10-12 10:54:48

Match Conditions Reference

Reading time: About 12 minutes

This page is a complete reference for the Match Conditions field used across all security policies.

General Information

Match conditions are used to precisely define the scope of a rule. Multiple conditions can be combined using the following logic:

  • AND (All conditions must be met): The request must satisfy all conditions simultaneously.
  • OR (Any condition met): The rule takes effect when the request satisfies any one of the conditions.

Available Field Types

Path

The path starts with / and does not include the domain or parameters. For example, the path of www.test.com/common/ecs/channel?code=1&type=2 is /common/ecs/channel.

Operator Description Example
Equals Exact match of the specified path /login
Not Equals Exclude the specified path Any path other than /health
Contains The path contains the specified string /api
Does Not Contain The path does not contain the specified string Exclude paths containing /static
Starts with Prefix match of the path /admin/
Ends with Suffix match of the path .php
Wildcard Match Match the path using wildcards /api/*/detail
Wildcard Not Match Exclude paths matched by the wildcard Any path other than /api/*/detail
Regex Match Match the path using a regular expression ^/api/v[0-9]+/
Regex Not Match Exclude paths matched by the regular expression Any path other than ^/api/v[0-9]+/

Case sensitivity and multiple values: Equals and Not Equals are case-sensitive; all other operators are case-insensitive. This field accepts multiple values, except Regex Match and Regex Not Match, which accept only a single value.

Performance tip: Regex matching consumes more computing resources than prefix or contains matching. Use prefix matching unless regex is necessary.

HTTP Method

Supported methods: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS

Supported operators: Equals, Not Equals. Multiple values supported: Yes.

Client IP

Format Example
Single IP 1.2.3.4
CIDR Range 1.2.3.0/24
IP Range 1.2.3.1-1.2.3.100

Supports IPv4 and IPv6. Supported operators: Equals, Not Equals. Multiple values supported: Yes.

Note: If the request is forwarded through a proxy or load balancer, the system uses the first IP in the X-Forwarded-For header as the client IP. Make sure your origin server is properly configured to pass this header.

HTTP Header

Header names are case-insensitive.

Operator Description
Equals The header value matches exactly
Not Equals The header value is not the specified content
Contains The header value contains the specified string
Does Not Contain The header value does not contain the specified string
Starts with The header value starts with the specified content
Ends with The header value ends with the specified content
Wildcard Match Match the header value using wildcards
Wildcard Not Match Exclude header values matched by the wildcard
Regex Match Match the header value using a regular expression
Regex Not Match Exclude header values matched by the regular expression
Does Not Exist or Has No Value The request does not carry the header, or the value is empty

Case sensitivity and multiple values: Equals and Not Equals are case-sensitive; all other operators are case-insensitive. This field accepts multiple values, except Regex Match and Regex Not Match, which accept only a single value.

User-Agent

Behaves the same as the HTTP Header field, but is a shortcut specifically for the User-Agent header. It supports the same set of operators.

Operator Example
Equals Mozilla/5.0 ...
Not Equals Anything other than Mozilla/5.0 ...
Contains Googlebot
Does Not Contain Exclude user agents containing Googlebot
Starts with Mozilla/
Ends with Safari/537.36
Wildcard Match Mozilla/*
Wildcard Not Match Anything other than Mozilla/*
Regex Match ^python-requests/
Regex Not Match Anything other than ^python-requests/
Does Not Exist or Has No Value —

Case sensitivity and multiple values: Equals and Not Equals are case-sensitive; all other operators are case-insensitive. This field accepts multiple values, except Regex Match and Regex Not Match, which accept only a single value.

Cookie

Operator Description
Cookie Name Exists The request carries a cookie with the specified name
Cookie Value Equals The value of the specified cookie matches exactly
Cookie Value Contains The value of the specified cookie contains a specific string

Referer

Behaves the same as the HTTP Header field, but is a shortcut for the Referer header. It supports the same set of operators.

Case sensitivity and multiple values: Equals and Not Equals are case-sensitive; all other operators are case-insensitive. This field accepts multiple values, except Regex Match and Regex Not Match, which accept only a single value.

Query String

Matches the query string carried in the request URL as a whole, for example code=1&type=2.

Operator Description Example
Equals The query string matches exactly code=1&type=2
Not Equals Exclude the specified query string Anything other than code=1&type=2
Contains The query string contains the specified string code=
Does Not Contain The query string does not contain the specified string Exclude requests containing debug=
Starts with The query string starts with the specified content code=1
Ends with The query string ends with the specified content type=2
Wildcard Match Match the query string using wildcards code=*&type=2
Wildcard Not Match Exclude query strings matched by the wildcard Anything other than code=*&type=2
Regex Match Match the query string using a regular expression ^code=[0-9]+
Regex Not Match Exclude query strings matched by the regular expression Anything other than ^code=[0-9]+
Does Not Exist or Has No Value The request carries no query string —

Case sensitivity and multiple values: Every operator on this field is case-sensitive, so the values you enter must match the casing your business actually sends. This field accepts multiple values, except Regex Match and Regex Not Match, which accept only a single value.

Use when: A WAF rule generates false positives for legitimate requests with specific query parameters. Use query string conditions to precisely define the exception scope.

URI

The difference between URI and Path: URI includes query parameters, while the path does not.

Example Path URI
https://example.com/search?q=test&page=1 /search /search?q=test&page=1

Supported operators: Equals, Not Equals, Contains, Does Not Contain, Starts with, Ends with, Wildcard Match, Wildcard Not Match, Regex Match, Regex Not Match

Case sensitivity and multiple values: Equals and Not Equals are case-sensitive; Contains, Starts with, Ends with, Wildcard, and Regex operators are case-insensitive. This field accepts multiple values, except Regex Match and Regex Not Match, which accept only a single value.

Geo Location

Determines the request source region based on the IP geolocation database, down to the country or province level (the exact options available depend on the console). Used for IP/Geo firewall policies.

Supported operators: Equals, Not Equals. Multiple values supported: Yes.

Status Code

Matches or excludes specific HTTP response status codes. Only response-phase status codes are evaluated.

Supported operators: Equals, Not Equals. Multiple values supported: Yes.

Use when: In rate limiting, you can set limits based on specific error response codes (e.g., 404, 5xx). In custom rules, you can trigger actions based on the response status code.

Client Group

Matches or excludes requests belonging to specific client groups. Client groups are automatically classified by the platform based on request characteristics.

Supported operators: Equals, Not Equals. Multiple values supported: Yes.

ASN (Autonomous System Number)

Matches requests based on the Autonomous System Number of the source IP. Useful for bulk actions targeting IP segments of specific ISPs, cloud providers, or data centers.

Supported operators: Equals, Not Equals. Multiple values supported: Yes.

Typical use cases: Blocking IP segments from specific cloud service providers (e.g., AWS, Alibaba Cloud, etc.), or allowing traffic from a specific enterprise leased line ASN.


Special Fields (Advanced Usage)

Field Description Typical Use Case
JA3 Fingerprint TLS handshake fingerprint used to identify specific TLS clients Identifying attackers using specific tools
Request Body Matches the content of POST request bodies Identifying specific malicious payloads
Is the content of this document helpful to you?
Yes
I have suggestion
Submitted successfully! Thank you very much for your feedback, we will continue to strive to do better!