Skip to content

Allow good bots in WAF rate-based rule

0

Hi everyone,

In AWS WAF, I have a rate-based rule that blocks if requests coming from a source IP address exceed the threshold, which is 120 requests within 2 minutes. The rule is also blocking requests from search engine bots.

I want to explicitly allow traffic from good bots, regardless of the number of requests they send, even if it exceeds the threshold. But at the same time, I also want to block IP addresses (from bad bots or anyone) that send too many requests. My question is: how can I do that with a rate-based rule? If I cannot do that with a rate-based rule, what should I do, or which rules should I set up to achieve this?

Thank you so much in advance.

1 Answer
1
Accepted Answer

Hello.

AWS WAF's rate-based rules should make judgments based on IP addresses, so if you know the IP address used by the bot you want to allow requests for, you can create an IP set.
However, this method cannot be used if the bot uses an unspecified number of IP addresses.
https://docs.aws.amazon.com/waf/latest/developerguide/waf-rule-statement-type-ipset-match.html

Alternatively, you may want to add a Bot Control rule to allow bots that AWS deems to be healthy.
If you place this rule above the rate-based rule, it will be evaluated first, so I don't think it will be blocked by the rate-based rule.
https://docs.aws.amazon.com/waf/latest/developerguide/waf-bot-control-example-allow-verified-bots.html

EXPERT

answered 2 years ago

EXPERT

reviewed 2 years ago

EXPERT

reviewed 2 years ago

  • Hi, Riku. I know the IP addresses of the bots but I think the bots use a lot of different IP addresses and I cannot keep updating the IP set.

    So, my only option is to use the paid AWS managed Bot Control rule group and remove the rate-based rule since it will be blocking any IP address that send too many requests?

  • So, my only option is to use the paid AWS managed Bot Control rule group and remove the rate-based rule since it will be blocking any IP address that send too many requests?

    It is possible to configure custom rules to allow matches in the request body or request headers, but this is not recommended as these values ​​can be easily forged. Therefore, I think it would be a good idea to use Bot Control, an AWS managed rule.

  • Thanks a lot for your answers, Riku.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.