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/ag-overview.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -170,7 +170,7 @@ In Anomaly Scoring mode, traffic that matches any rule isn't immediately blocked
170
170
There's a threshold of 5 for the Anomaly Score to block traffic. So, a single *Critical* rule match is enough for the Application Gateway WAF to block a request in Prevention mode. But one *Warning* rule match only increases the Anomaly Score by 3, which isn't enough by itself to block the traffic.
171
171
172
172
> [!NOTE]
173
-
> The message that's logged when a WAF rule matches traffic includes the action value "Matched." If the total anomaly score of all matched rules is 5 or greater, and the WAF policy is running in Prevention mode, the request triggers a mandatory anomaly rule with the action value *Blocked*, and the request is stopped. However, if the WAF policy is running in Detection mode, the request triggers the action value *Detected*, and the request is logged and passed to the backend. For more information, see [Troubleshoot Web Application Firewall (WAF) for Azure Application Gateway](web-application-firewall-troubleshoot.md#understanding-waf-logs).
173
+
> The message that's logged when a WAF rule matches traffic includes the action value "Matched." If the total anomaly score of all matched rules is 5 or greater, and the WAF policy is running in Prevention mode, the request triggers a mandatory anomaly rule with the action value *Blocked*, and the request is stopped. However, if the WAF policy is running in Detection mode, the request triggers the action value *Detected*, and the request is logged and passed to the backend. For more information, see [Troubleshoot Web Application Firewall (WAF) for Azure Application Gateway](web-application-firewall-troubleshoot.md#understand-waf-logs).
Copy file name to clipboardExpand all lines: articles/web-application-firewall/ag/web-application-firewall-troubleshoot.md
+75-19Lines changed: 75 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,8 +5,8 @@ description: This article provides troubleshooting information for Web Applicati
5
5
author: halkazwini
6
6
ms.author: halkazwini
7
7
ms.service: azure-web-application-firewall
8
-
ms.topic: concept-article
9
-
ms.date: 05/09/2025
8
+
ms.topic: how-to
9
+
ms.date: 06/13/2025
10
10
---
11
11
12
12
# Troubleshoot Web Application Firewall (WAF) for Azure Application Gateway
@@ -17,7 +17,7 @@ Start by reviewing the [WAF overview](ag-overview.md) and [WAF configuration](ap
17
17
18
18
The OWASP rule sets are designed to be strict out of the box, and to be tuned to suit the specific needs of the application or organization using WAF. It's entirely normal, and expected in many cases, to create exclusions, custom rules, and even disable rules that may be causing issues or false positives. Per-site and per-URI policies allow for these changes to only affect specific sites/URIs. So changes shouldn’t have to affect other sites that may not be running into the same issues.
19
19
20
-
## Understanding WAF logs
20
+
## Understand WAF logs
21
21
22
22
The purpose of WAF logs is to show every request that WAF matches or blocks. It's a ledger of all evaluated requests that are matched or blocked. If you notice that the WAF blocks a request that it shouldn't (a false positive), you can do a few things. First, narrow down, and find the specific request. Look through the logs to find the specific URI, timestamp, or transaction ID of the request. When you find the associated log entries, you can begin to act on the false positives.
23
23
@@ -130,49 +130,107 @@ The final two log entries show the request was blocked because the anomaly score
130
130
}
131
131
```
132
132
133
-
## Fixing false positives
133
+
## Fix false positives
134
134
135
135
With this information, and the knowledge that rule 942130 is the one that matched the `1=1` string, you can do a few things to stop this from blocking your traffic:
136
136
137
137
- Use an exclusion list. For more information about exclusion lists, see [WAF exclusion lists](application-gateway-waf-configuration.md).
138
138
139
139
- Disable the rule.
140
140
141
-
### Using an exclusion list
141
+
### Use an exclusion list
142
142
143
143
To make an informed decision about handling a false positive, it’s important to familiarize yourself with the technologies your application uses. For example, say there isn't a SQL server in your technology stack, and you're getting false positives related to those rules. Disabling those rules doesn't necessarily weaken your security.
144
144
145
145
One benefit of using an exclusion list is that only a specific part of a request is being disabled. However, this means that a specific exclusion is applicable to all traffic passing through your WAF because it's a global setting. For example, this could lead to an issue if *1=1* is a valid request in the body for a certain app, but not for others. Another benefit is that you can choose between body, headers, and cookies to be excluded if a certain condition is met, as opposed to excluding the whole request.
146
146
147
147
Occasionally, there are cases where specific parameters get passed into the WAF in a manner that may not be intuitive. For example, there's a token that gets passed when authenticating using Microsoft Entra ID. *__RequestVerificationToken* is usually passed in as a request cookie. However, in some cases where cookies are disabled, this token is also passed as a request attribute or `arg`. If this happens, you need to ensure that *__RequestVerificationToken* is added to the exclusion list as a **Request attribute name** as well.
148
148
149
-
:::image type="content" source="../media/web-application-firewall-troubleshoot/exclusion-list.png" alt-text="Screenshot that shows the exclusion list.":::
149
+
:::image type="content" source="../media/web-application-firewall-troubleshoot/exclusion-list.png" alt-text="Screenshot that shows the exclusion list." lightbox="../media/web-application-firewall-troubleshoot/exclusion-list.png":::
150
150
151
-
In this example, you want to exclude the **Request attribute name** that equals *text1*. This is apparent because you can see the attribute name in the firewall logs: **data: Matched Data: 1=1 found within ARGS:text1: 1=1**. The attribute is **text1**. You can also find this attribute name a few other ways, see [Finding request attribute names](#finding-request-attribute-names).
151
+
In this example, you want to exclude the **Request attribute name** that equals *text1*. This is apparent because you can see the attribute name in the firewall logs: **data: Matched Data: 1=1 found within ARGS:text1: 1=1**. The attribute is **text1**. You can also find this attribute name a few other ways, see [Finding request attribute names](#find-request-attribute-names).
152
152
153
-
:::image type="content" source="../media/web-application-firewall-troubleshoot/waf-config.png" alt-text="Screenshot that shows how to configure WAF exclusion lists.":::
153
+
:::image type="content" source="../media/web-application-firewall-troubleshoot/waf-config.png" alt-text="Screenshot that shows how to configure WAF exclusion lists." lightbox="../media/web-application-firewall-troubleshoot/waf-config.png":::
154
154
155
155
You can create exclusions for WAF in Application Gateway at different scope levels. For more information, see [Web Application Firewall exclusion lists](application-gateway-waf-configuration.md#exclusion-scopes).
156
156
157
-
### Disabling rules
157
+
### Disable rules
158
158
159
159
Another way to get around a false positive is to disable the rule that matched on the input the WAF thought was malicious. Since you've parsed the WAF logs and have narrowed the rule down to 942130, you can disable it in the Azure portal. See [Customize web application firewall rules through the Azure portal](application-gateway-customize-waf-rules-portal.md).
160
160
161
161
One benefit of disabling a rule is that if you know all traffic that contains a certain condition that is normally blocked is valid traffic, you can disable that rule for the entire WAF. However, if it’s only valid traffic in a specific use case, you open up a vulnerability by disabling that rule for the entire WAF since it's a global setting.
162
162
163
163
If you want to use Azure PowerShell, see [Customize web application firewall rules through PowerShell](application-gateway-customize-waf-rules-powershell.md). If you want to use Azure CLI, see [Customize web application firewall rules through the Azure CLI](application-gateway-customize-waf-rules-cli.md).
164
164
165
-
## Finding request attribute names
165
+
## Record HAR files
166
+
167
+
You can use your browser or an external tool like Fiddler to record HTTP Archive (HAR) files. HAR files contain information about the requests and responses that your browser makes when loading a web page. This information can be useful for troubleshooting WAF issues.
168
+
169
+
> [!TIP]
170
+
> It's a good practice to have the HAR file ready when you contact support. The support team can use the HAR file to help diagnose the issue.
171
+
172
+
# [**Edge**](#tab/edge)
173
+
174
+
To record and save a HAR file in Microsoft Edge, follow these steps
175
+
176
+
1. Press **F12** or **Ctrl+Shift+I** to launch Edge Developer tools. You can also launch the tools from the toolbar menu under **More tools > Developer tools**.
177
+
178
+
1. In the **Console** tab, select **Clear console** or press **Ctrl+L**.
179
+
180
+
:::image type="content" source="../media/web-application-firewall-troubleshoot/edge-dev-tools-console.png" alt-text="Screenshot of the Console tab of Microsoft Edge developer tools.":::
181
+
182
+
1. Select the **Network** tab.
183
+
184
+
1. Select **Clear network log** or press **Ctrl+L**, and then select the **Record network log** if it's not recording.
185
+
186
+
:::image type="content" source="../media/web-application-firewall-troubleshoot/edge-dev-tools-network.png" alt-text="Screenshot of the Network tab of Microsoft Edge developer tools.":::
187
+
188
+
1. Load the webpage that's protected by your WAF for which you want to troubleshoot.
189
+
190
+
1. Stop recording by selecting the **Stop recording network log**.
191
+
192
+
1. Select **Export HAR (sanitized)...** and save the HAR file.
193
+
194
+
:::image type="content" source="../media/web-application-firewall-troubleshoot/edge-dev-tools-save-file.png" alt-text="Screenshot that shows how to save the HAR file in Microsoft Edge developer tools.":::
195
+
196
+
# [**Chrome**](#tab/chrome)
197
+
198
+
To record and save a HAR file in Google Chrome, follow these steps
199
+
200
+
1. Press **F12** or **Ctrl+Shift+I** to launch Chrome Developer tools. You can also launch the tools from the toolbar menu under **More tools > Developer tools**.
201
+
202
+
1. In the **Console** tab, select **Clear console** or press **Ctrl+L**.
203
+
204
+
:::image type="content" source="../media/web-application-firewall-troubleshoot/chrome-dev-tools-console.png" alt-text="Screenshot of the Console tab of Google Chrome developer tools.":::
205
+
206
+
1. Select the **Network** tab.
207
+
208
+
1. Select **Clear network log** or press **Ctrl+L**, and then select the **Record network log** if it's not recording.
209
+
210
+
:::image type="content" source="../media/web-application-firewall-troubleshoot/chrome-dev-tools-network.png" alt-text="Screenshot of the Network tab of Google Chrome developer tools.":::
211
+
212
+
1. Load the webpage that's protected by your WAF for which you want to troubleshoot.
213
+
214
+
1. Stop recording by selecting the **Stop recording network log**.
215
+
216
+
1. Select **Export HAR (sanitized)...** and save the HAR file.
217
+
218
+
:::image type="content" source="../media/web-application-firewall-troubleshoot/chrome-dev-tools-save-file.png" alt-text="Screenshot that shows how to save the HAR file in Google Chrome developer tools.":::
219
+
220
+
---
221
+
222
+
223
+
## Find request attribute names
166
224
167
225
With the help of [Fiddler](https://www.telerik.com/fiddler), you inspect individual requests and determine what specific fields of a web page are called. This can help to exclude certain fields from inspection using Exclusion Lists.
168
226
169
227
In this example, you can see that the field where the *1=1* string was entered is called **text1**.
170
228
171
-
:::image type="content" source="../media/web-application-firewall-troubleshoot/fiddler-1.png" alt-text="Screenshot of the Progress Telerik Fiddler Web Debugger. In the Raw tab, 1 = 1 is visible after the name text1.":::
229
+
:::image type="content" source="../media/web-application-firewall-troubleshoot/fiddler-1.png" alt-text="Screenshot of the Progress Telerik Fiddler Web Debugger. In the Raw tab, 1 = 1 is visible after the name text1." lightbox="../media/web-application-firewall-troubleshoot/fiddler-1.png":::
172
230
173
231
This is a field you can exclude. To learn more about exclusion lists, See [Web application firewall exclusion lists](application-gateway-waf-configuration.md). You can exclude the evaluation in this case by configuring the following exclusion:
174
232
175
-
:::image type="content" source="../media/web-application-firewall-troubleshoot/waf-exclusion-02.png" alt-text="Screenshot that shows WAF exclusion.":::
233
+
:::image type="content" source="../media/web-application-firewall-troubleshoot/waf-exclusion-02.png" alt-text="Screenshot that shows WAF exclusion." lightbox="../media/web-application-firewall-troubleshoot/waf-exclusion-02.png":::
176
234
177
235
You can also examine the firewall logs to get the information to see what you need to add to the exclusion list. To enable logging, see [Back-end health, resource logs, and metrics for Application Gateway](../../application-gateway/application-gateway-diagnostics.md).
178
236
@@ -289,17 +347,15 @@ The first entry is logged because the user used a numeric IP address to navigate
289
347
290
348
The second one (rule 942130) is the interesting one. You can see in the details that it matched a pattern `(1=1)`, and the field is named **text1**. Follow the same previous steps to exclude the **Request Attribute Name** that equals `1=1`.
291
349
292
-
## Finding request header names
350
+
## Find request header names
293
351
294
352
Fiddler is a useful tool once again to find request header names. In the following screenshot, you can see the headers for this GET request, which include *Content-Type*, *User-Agent*, and so on.
295
353
296
-
:::image type="content" source="../media/web-application-firewall-troubleshoot/fiddler-2.png" alt-text="Screenshot of the Progress Telerik Fiddler Web Debugger. The Raw tab lists request header details like the connection, content-type, and user-agent." border="false":::
297
-
298
-
Another way to view request and response headers is to look inside the developer tools of Chrome. You can press F12 or right-click -> **Inspect** -> **Developer Tools**, and select the **Network** tab. Load a web page, and select the request you want to inspect.
354
+
:::image type="content" source="../media/web-application-firewall-troubleshoot/fiddler-2.png" alt-text="Screenshot of the Progress Telerik Fiddler Web Debugger. The Raw tab lists request header details like the connection, content-type, and user-agent." lightbox="../media/web-application-firewall-troubleshoot/fiddler-2.png":::
299
355
300
-
:::image type="content" source="../media/web-application-firewall-troubleshoot/chrome-f12.png" alt-text="Screenshot that shows the result of clicking F12 in a Chrome browser.":::
356
+
Another way to view request and response headers is to use the developer tools of Microsoft Edge or Google Chrome. For more information, see [Record HAR files](#record-har-files).
301
357
302
-
## Finding request cookie names
358
+
## Find request cookie names
303
359
304
360
If the request contains cookies, the **Cookies** tab can be selected to view them in Fiddler.
305
361
@@ -315,7 +371,7 @@ If the request contains cookies, the **Cookies** tab can be selected to view the
315
371
316
372
By disabling max request body limit, WAF can process large request bodies without rejecting them for exceeding the size limit. This setting is useful if you regularly have large requests.
317
373
318
-
When you disable this option, the request body will only be inspected up to the maximum request body inspection limit. If there's malicious content in the request beyond the max request body inspection limit the WAF won't detect it.
374
+
When you disable this option, the request body will only be inspected up to the maximum request body inspection limit. If there's malicious content in the request beyond the max request body inspection limit, the WAF won't detect it.
0 commit comments