When you configure a whitelist or custom rules, you define match conditions to specify which requests to inspect. Each match condition consists of a match field and a logical operator.
What is a match condition
A match condition defines the request characteristics that DCDN WAF inspects at the edge. When you configure a custom protection policy, a whitelist, or an IP address blacklist, you use one or more Match Condition to define the criteria for a rule. If an incoming request meets the match conditions, it triggers the rule. WAF then applies the specified rule action to the request, such as Block, JavaScript Validation, or Monitor.
Supported match fields
The following table describes the available match fields.
|
Match field |
Logical operators |
Description |
|
URI |
|
The uniform resource identifier (URI) of a request, which specifies the resource path. The value must start with a forward slash ( |
|
IP |
|
The source IP address of the requesting client. The value must meet the following requirements:
|
|
Referer |
|
The URL of the originating page. |
|
User-Agent |
|
Information about the client's browser, such as its identity, rendering engine, and version. |
|
Query string |
|
The part of the URL that follows the question mark (?). |
|
Cookie |
|
The cookie information in the request. |
|
Content-Type |
|
The media type of the request body, as specified in the Content-Type header. Also known as the MIME type. |
|
Content-Length |
Is Less Than, Is Equal To, Is Greater Than |
The size of the request body in bytes. Valid values: 0 to 8192. |
|
X-Forwarded-For |
|
The original client IP address, identified by the X-Forwarded-For (XFF) request header when traffic passes through an HTTP proxy or load balancer. This header is present only if the request is routed through a proxy or load balancer. |
|
Request body |
|
The content of the request body. WAF does not inspect request bodies larger than 8 KB. |
|
HTTP method |
|
The method used in the request. Supported methods include GET, POST, DELETE, PUT, OPTIONS, CONNECT, HEAD, TRACE, and PATCH. |
|
Header |
|
The request headers. Custom header fields are supported. |
|
URI path |
|
The path component of the request URI. |
|
Query string parameter |
|
A parameter in the query string. For example, in the URL |
|
Host |
|
The domain name being requested. |
|
CookieName |
|
The name (or key) of a cookie. For example, in the cookie |
|
BodyParameter |
|
The name of a parameter in the request body. For example, if a request body contains the string |
|
Filename |
|
The name of the file at the end of the URI path. For example, in |
|
File extension |
|
The extension of the requested file, such as |
Logical operators
|
Logical operator |
Description |
|
Is, Is Not |
Checks if the field value is or is not the specified IP address or CIDR block. |
|
Contains, Does Not Contain |
Checks if the field value contains or does not contain the specified substring. |
|
Is in, Is Not in |
Checks if the field value is or is not in the specified list of IP addresses. |
|
Contains One of, Does Not Contain Any of |
Checks if the field value contains at least one of the specified substrings, or does not contain any of the specified substrings. |
|
Equals, Does Not Equal |
Checks if the field value exactly matches or does not match the specified value. |
|
Equals One of, Does Not Equal Any of |
Checks if the field value exactly matches at least one of the specified values, or does not match any of the specified values. |
|
Length Equals, Length Is Greater Than, Length Is Less Than |
Compares the length of the field value in bytes to the specified numeric value. |
|
Exists, Does Not Exist |
Checks if the specified field exists or does not exist in the request. |
|
Is Less Than, Is Equal To, Is Greater Than |
Compares the numeric value of the field to the specified numeric value. |
|
Starts With, Ends With |
Checks if the field value starts with or ends with the specified substring. |
|
Regex Match, Regex Mismatch |
Checks if the field value matches or does not match the specified regular expression (regex). |
|
Is Empty |
Checks if the field value is empty. |
Configuration examples
-
Example 1: Set match field to
URI, logical operator toContains, and Match content to/login.php. This rule triggers if a request's URI contains/login.php. -
Example 2: Set match field to
IP, logical operator toIs, and Match content to 192.168.0.1. This rule triggers for requests from the IP address 192.168.0.1.