Skip to content

Commit a3d979e

Browse files
committed
use tabs and add a note
1 parent 0b2b4df commit a3d979e

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

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

Lines changed: 25 additions & 16 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,11 @@ 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"
3031

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+
> [!NOTE]
33+
> If you leave the block response body blank, the WAF will respond 403 (forbidden) on normal WAF blocks and will respond 429 (too many requests) on rate limit blocks.
3234
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
35+
# [**PowerShell**](#tab/powershell)
4236

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

@@ -111,6 +105,21 @@ Update-AzFrontDoorFireWallPolicy `
111105
-CustomBlockResponseBody "<html><head><title>Forbidden</title></head><body>{{azure-ref}}</body></html>"
112106
```
113107

114-
## Next steps
108+
---
109+
110+
::: zone pivot="front-door-standard-premium"
111+
112+
"{{azure-ref}}" inserts the unique reference string in the response body. The value matches the TrackingReference field in the `FrontDoorAccessLog` and `FrontDoorWebApplicationFirewallLog` logs.
113+
114+
::: zone-end
115+
116+
::: zone pivot="front-door-classic"
117+
118+
"{{azure-ref}}" inserts the unique reference string in the response body. The value matches the TrackingReference field in the `FrontdoorAccessLog` and `FrontdoorWebApplicationFirewallLog` logs.
119+
120+
::: zone-end
121+
122+
## Next step
115123

116-
Learn more about [Azure Web Application Firewall on Azure Front Door](../afds/afds-overview.md).
124+
> [!div class="nextstepaction"]
125+
> [Configure a Web Application Firewall rate-limit rule](../afds/waf-front-door-rate-limit-configure.md).

0 commit comments

Comments
 (0)