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
title: Configure custom responses for Azure Web Application Firewall with Application Gateway
2
+
title: Configure custom responses for Azure Application Gateway WAF
3
3
description: Learn how to configure a custom response code and body (message) when Azure Web Application Firewall blocks a request.
4
4
author: YaakobiEden
5
5
ms.author: edenyaakobi
6
6
ms.service: azure-web-application-firewall
7
7
ms.topic: how-to
8
-
ms.date: 03/11/2025
8
+
ms.date: 08/24/2025
9
9
---
10
10
11
-
12
-
# Configure custom response code and body for Azure Application Gateway WAF
13
-
11
+
# Configure custom response code and body for Application Gateway WAF
14
12
15
13
By default, when Web Application Firewall (WAF) on Application Gateway blocks a request due to a matched rule, it returns a 403 status code with the message "The request is blocked." You can customize the response by configuring a custom status code and message to better suit your use case.
16
14
17
-
This article shows you how to configure a custom response page when Azure Application Gateway's Web Application Firewall (WAF) blocks a request using the Azure portal. You can also configure custom responses using the [Azure CLI](/cli/azure/network/application-gateway/waf-policy/policy-setting)and PowerShell.
15
+
This article shows you how to configure a custom response page when Azure Application Gateway's Web Application Firewall (WAF) blocks a request using the Azure portal. You can also configure custom responses using the [Azure CLI](/cli/azure/network/application-gateway/waf-policy/policy-setting)or PowerShell.
18
16
19
17
## Configure a custom response status code and message
20
18
@@ -26,17 +24,16 @@ To customize the response status code and body, take the following steps:
26
24
27
25
1. Enter the custom response status code and response body in **Block response status code** and **Block response body** respectively.
28
26
27
+
:::image type="content" source="../media/configure-custom-response-code/application-gateway-custom-response-settings.png" alt-text="Screenshot that shows Azure Web Application Firewall policy settings." lightbox="../media/configure-custom-response-code/application-gateway-custom-response-settings.png":::
29
28
29
+
1. Select **Save**.
30
30
31
-
:::image type="content" source="../media/application-gateway-waf-configure-custom-response-code-and-body/ag-waf-custom-response-settings.png" alt-text="Screenshot that shows Azure Web Application Firewall Policy settings." lightbox="../media/application-gateway-waf-configure-custom-response-code-and-body/ag-waf-custom-response-settings.png":::
32
-
33
-
4. Select **Save**.
34
-
35
-
In this example, we changed the default 403 response code to 429 and set a brief message stating, "The request has been blocked".
36
-
37
-
:::image type="content" source="../media/application-gateway-waf-configure-custom-response-code-and-body/ag-waf-custom-response.png" alt-text="Screenshot that shows a custom response example.":::
31
+
In this example, we changed the default 403 response code to 429 and set a brief message stating, *The request has been blocked*.
38
32
33
+
:::image type="content" source="../media/configure-custom-response-code/application-gateway-custom-response.png" alt-text="Screenshot that shows a custom response example.":::
39
34
40
-
## Next steps
35
+
## Related content
41
36
42
-
Learn more about [Azure Web Application Firewall on Application Gateway](../ag/ag-overview.md).
37
+
-[Azure Web Application Firewall policy](policy-overview.md)
38
+
-[Create Web Application Firewall policies for Application Gateway](create-waf-policy-ag.md)
39
+
-[Azure Web Application Firewall on Application Gateway](ag-overview.md)
0 commit comments