Edit

Share via


Configure a custom response for Azure Web Application Firewall

In this article, you learn how to configure a custom response page when Azure Web Application Firewall blocks a request.

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 for the request. You can configure a custom response status code and a custom message with a reference string for your use case.

Configure a custom response status code and message

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

Screenshot that shows Azure Web Application Firewall Policy settings.

In the preceding example, we kept the response code as 403 and configured a short "Please contact us" message, as shown in the following image:

Screenshot that shows a custom response example.

Note

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.

"{{azure-ref}}" inserts the unique reference string in the response body. The value matches the TrackingReference field in the FrontDoorAccessLog and FrontDoorWebApplicationFirewallLog logs.

"{{azure-ref}}" inserts the unique reference string in the response body. The value matches the TrackingReference field in the FrontdoorAccessLog and FrontdoorWebApplicationFirewallLog logs.

Next step