You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/web-application-firewall/ag/custom-waf-rules-overview.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ author: halkazwini
5
5
ms.author: halkazwini
6
6
ms.service: azure-web-application-firewall
7
7
ms.topic: concept-article
8
-
ms.date: 01/30/2024
8
+
ms.date: 03/30/2025
9
9
ms.custom: devx-track-azurepowershell
10
10
---
11
11
@@ -15,21 +15,21 @@ The Azure Application Gateway Web Application Firewall (WAF) v2 comes with a pre
15
15
16
16
Custom rules allow you to create your own rules that are evaluated for each request that passes through the WAF. These rules hold a higher priority than the rest of the rules in the managed rule sets. The custom rules contain a rule name, rule priority, and an array of matching conditions. If these conditions are met, an action is taken (to allow, block, or log). If a custom rule is triggered, and an allow or block action is taken, no further actions from custom or managed rules is taken. In the event of a custom rule triggering an allow or a block action, you may still see some log events for rule matches from configured ruleset (Core Rule Set/Default Rule Set) but those rules aren't enforced. The log events show merely due to the optimization enforced by the WAF engine for parallel rule processing and can be safely ignored. Custom rules can be enabled/disabled on demand.
17
17
18
-
For example, you can block all requests from an IP address in the range 192.168.5.0/24. In this rule, the operator is *IPMatch*, the matchValues is the IP address range (192.168.5.0/24), and the action is to block the traffic. You also set the rule's name, priority and enabled/disabled state.
18
+
For example, you can block all requests from an IP address in the range 192.168.5.0/24. In this rule, the operator is *IPMatch*, the matchValues is the IP address range (192.168.5.0/24), and the action is to block the traffic. You also set the rule's name, priority, and enabled/disabled state.
19
19
20
20
Custom rules support using compounding logic to make more advanced rules that address your security needs. For example, you can use two custom rules to create the following logic ((rule1:Condition 1 **and** rule1:Condition 2) **or** rule2:Condition 3). This logic means that if Condition 1 **and** Condition 2 are met, **or** if Condition 3 is met, the WAF should take the action specified in the custom rules.
21
21
22
22
Different matching conditions within the same rule are always compounded using **and**. For example, block traffic from a specific IP address, and only if they're using a certain browser.
23
23
24
-
If you want to use **or** between two different conditions,then the two conditions must be in different rules. For example, block traffic from a specific IP address or block traffic if they're using a specific browser.
24
+
If you want to use **or** between two different conditions,then the two conditions must be in different rules. For example, block traffic from a specific IP address or block traffic if they're using a specific browser.
25
25
26
26
Regular expressions are also supported in custom rules, just like in the CRS rulesets. For examples, see Examples 3 and 5 in [Create and use custom web application firewall rules](create-custom-waf-rules.md).
27
27
28
28
> [!NOTE]
29
29
> The maximum number of WAF custom rules is 100. For more information about Application Gateway limits, see [Azure subscription and service limits, quotas, and constraints](../../azure-resource-manager/management/azure-subscription-service-limits.md#azure-application-gateway-limits).
30
30
31
31
> [!CAUTION]
32
-
> Any redirect rules applied at the application gateway level will bypass WAF custom rules. See [Application Gateway redirect overview](../../application-gateway/redirect-overview.md) for more information about redirect rules.
32
+
> Any redirect rules applied at the application gateway level will bypass WAF custom rules. For more information, see [Application Gateway redirect overview](../../application-gateway/redirect-overview.md).
33
33
34
34
## Allowing vs. blocking
35
35
@@ -93,7 +93,7 @@ This custom rule contains a name, priority, an action, and the array of matching
93
93
94
94
### Name [optional]
95
95
96
-
The name of the rule. It appears in the logs.
96
+
The name of the rule. It appears in the logs.
97
97
98
98
### Enable rule [optional]
99
99
@@ -148,7 +148,7 @@ Negates the current condition.
148
148
149
149
### Transform [optional]
150
150
151
-
A list of strings with names of transformations to do before the match is attempted. These can be the following transformations:
151
+
A list of string values specifying transformations to apply before attempting a match. The available transformations include:
152
152
153
153
- Lowercase
154
154
- Uppercase
@@ -163,7 +163,7 @@ A list of strings with names of transformations to do before the match is attemp
163
163
List of values to match against, which can be thought of as being *OR*'ed. For example, it could be IP addresses or other strings. The value format depends on the previous operator.
164
164
165
165
> [!NOTE]
166
-
> If your WAF is running Core Rule Set (CRS) 3.1, or any other earlier CRS version, the match value only allows letters, numbers and punctuation marks. Quotation marks `"`, `'` and spaces are not supported.
166
+
> If your WAF is running Core Rule Set (CRS) 3.1, or any other earlier CRS version, the match value only allows letters, numbers, and punctuation marks. Quotation marks `"`, `'` and spaces aren't supported.
167
167
168
168
Supported HTTP request method values include:
169
169
- GET
@@ -181,7 +181,7 @@ In WAF policy detection mode, if a custom rule is triggered, the action is alway
181
181
- Allow – Authorizes the transaction, skipping all other rules. The specified request is added to the allowlist and once matched, the request stops further evaluation and is sent to the backend pool. Rules that are on the allowlist aren't evaluated for any further custom rules or managed rules.
182
182
- Block - Blocks or logs the transaction based on SecDefaultAction (detection/prevention mode).
183
183
- Prevention mode - Blocks the transaction based on SecDefaultAction. Just like the `Allow` action, once the request is evaluated and added to the blocklist, evaluation is stopped and the request is blocked. Any request after that meets the same conditions isn't evaluated and is blocked.
184
-
- Detection mode - Logs the transaction based on SecDefaultAction after which evaluation is stopped. Any request after that meets the same conditions isn't evaluated and is just logged.
184
+
- Detection mode - Logs the transaction based on SecDefaultAction after which evaluation is stopped. Any request after that meets the same conditions isn't evaluated and is logged.
185
185
- Log – Lets the rule write to the log, but lets the rest of the rules run for evaluation. The other custom rules are evaluated in order of priority, followed by the managed rules.
186
186
187
187
## Copying and duplicating custom rules
@@ -192,7 +192,7 @@ Custom rules can be duplicated within a given policy. When duplicating a rule, y
192
192
193
193
Custom rules let you create tailored rules to suit the exact needs of your applications and security policies. You can restrict access to your web applications by country/region. For more information, see [Geomatch custom rules](geomatch-custom-rules.md).
194
194
195
-
## Next steps
195
+
## Next step
196
196
197
-
-[Create your own custom rules](create-custom-waf-rules.md)
198
-
-[Learn more about Azure network security](../../networking/security/index.yml)
197
+
> [!div class="nextstepaction"]
198
+
> [Create your own custom rules](create-custom-waf-rules.md)
0 commit comments