'AWS WAF: How to make custom response code with managed rules for block actions

AWS added the option to return custom status code, instead of the default 403.

From here: https://aws.amazon.com/blogs/security/customize-requests-and-responses-with-aws-waf/ I added custom status for my own rules, but it seems like for managed rules (e.g - Cyber Security Cloud Managed Rules), there is no way to change the action and status.

Can someone help here please?



Solution 1:[1]

You will have to use labels for this: https://docs.aws.amazon.com/waf/latest/developerguide/waf-rule-labels.html

Write a custom rule to act on the labels and then have a custom response on the custom rule you create.

Use custom responses to change the default block action for a managed rule group

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shitij Mathur