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/afds/waf-front-door-configure-custom-response-code.md
+26-18Lines changed: 26 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,18 +5,20 @@ author: halkazwini
5
5
ms.author: halkazwini
6
6
ms.service: azure-web-application-firewall
7
7
ms.topic: how-to
8
-
ms.date: 08/16/2022
8
+
ms.date: 04/04/2025
9
9
ms.custom: devx-track-azurepowershell
10
10
zone_pivot_groups: front-door-tiers
11
11
---
12
12
13
13
# Configure a custom response for Azure Web Application Firewall
14
14
15
-
This article describes how to configure a custom response page when Azure Web Application Firewall blocks a request.
15
+
In this article, you learn how to configure a custom response page when Azure Web Application Firewall blocks a request.
16
16
17
17
By default, when Azure Web Application Firewall blocks a request because of a matched rule, it returns a 403 status code with the message "The request is blocked." The default message also includes the tracking reference string that's used to link to [log entries](./waf-front-door-monitor.md) for the request. You can configure a custom response status code and a custom message with a reference string for your use case.
18
18
19
-
## Configure a custom response status code and message by using the portal
19
+
## Configure a custom response status code and message
20
+
21
+
# [**Portal**](#tab/portal)
20
22
21
23
You can configure a custom response status code and body under **Policy settings** on the Azure Web Application Firewall portal.
22
24
@@ -26,19 +28,7 @@ In the preceding example, we kept the response code as 403 and configured a shor
26
28
27
29
:::image type="content" source="../media/waf-front-door-configure-custom-response-code/custom-response.png" alt-text="Screenshot that shows a custom response example.":::
28
30
29
-
::: zone pivot="front-door-standard-premium"
30
-
31
-
"{{azure-ref}}" inserts the unique reference string in the response body. The value matches the TrackingReference field in the `FrontDoorAccessLog` and `FrontDoorWebApplicationFirewallLog` logs.
32
-
33
-
::: zone-end
34
-
35
-
::: zone pivot="front-door-classic"
36
-
37
-
"{{azure-ref}}" inserts the unique reference string in the response body. The value matches the TrackingReference field in the `FrontdoorAccessLog` and `FrontdoorWebApplicationFirewallLog` logs.
38
-
39
-
::: zone-end
40
-
41
-
## Configure a custom response status code and message by using PowerShell
31
+
# [**PowerShell**](#tab/powershell)
42
32
43
33
Follow these steps to configure a custom response status code and message by using PowerShell.
> If you leave the block response body blank, the WAF returns a *403 Forbidden* response for normal WAF blocks and a *429 Too many requests* for rate limit blocks.
108
+
109
+
::: zone pivot="front-door-standard-premium"
110
+
111
+
"{{azure-ref}}" inserts the unique reference string in the response body. The value matches the TrackingReference field in the `FrontDoorAccessLog` and `FrontDoorWebApplicationFirewallLog` logs.
112
+
113
+
::: zone-end
114
+
115
+
::: zone pivot="front-door-classic"
116
+
117
+
"{{azure-ref}}" inserts the unique reference string in the response body. The value matches the TrackingReference field in the `FrontdoorAccessLog` and `FrontdoorWebApplicationFirewallLog` logs.
118
+
119
+
::: zone-end
120
+
121
+
## Next step
115
122
116
-
Learn more about [Azure Web Application Firewall on Azure Front Door](../afds/afds-overview.md).
123
+
> [!div class="nextstepaction"]
124
+
> [Configure a Web Application Firewall rate-limit rule](../afds/waf-front-door-rate-limit-configure.md)
0 commit comments