Skip to content

Commit 5f5d743

Browse files
authored
Merge pull request #297622 from halkazwini/waf-custom
Custom response
2 parents be5725b + ce1d8e3 commit 5f5d743

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

articles/web-application-firewall/afds/waf-front-door-configure-custom-response-code.md

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,20 @@ author: halkazwini
55
ms.author: halkazwini
66
ms.service: azure-web-application-firewall
77
ms.topic: how-to
8-
ms.date: 08/16/2022
8+
ms.date: 04/04/2025
99
ms.custom: devx-track-azurepowershell
1010
zone_pivot_groups: front-door-tiers
1111
---
1212

1313
# Configure a custom response for Azure Web Application Firewall
1414

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.
1616

1717
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.
1818

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)
2022

2123
You can configure a custom response status code and body under **Policy settings** on the Azure Web Application Firewall portal.
2224

@@ -26,19 +28,7 @@ In the preceding example, we kept the response code as 403 and configured a shor
2628

2729
:::image type="content" source="../media/waf-front-door-configure-custom-response-code/custom-response.png" alt-text="Screenshot that shows a custom response example.":::
2830

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)
4232

4333
Follow these steps to configure a custom response status code and message by using PowerShell.
4434

@@ -111,6 +101,24 @@ Update-AzFrontDoorFireWallPolicy `
111101
-CustomBlockResponseBody "<html><head><title>Forbidden</title></head><body>{{azure-ref}}</body></html>"
112102
```
113103

114-
## Next steps
104+
---
105+
106+
> [!NOTE]
107+
> 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
115122

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

Comments
 (0)