IP redirect US traffic but allow known bots

What is the name of the domain?

What is the issue you’re encountering

How and where to configure IP redirect for US traffic but allow known bots

What steps have you taken to resolve the issue?

I tried to create a redirect rule but it seems it is not possible to add a known bots filter here. I also tried to create a custom WAF rule but I don’t know how to add a redirect to another domain here (instead of just blocking the traffic). I’m on the PRO plan. Any help is much appreciated!

Bot score is not calculated yet when redirect rules are executed, so you will need to evaluate it further down the request processing pipeline and execute the redirect there.

Since you are on a Pro plan, you can use Snippets. Here is an example of a redirect code: Redirect from one domain to another · Cloudflare Rules docs.

Even though you won’t be able to select Known bots from the dropdown in the Snippet rule, you can still use custom filter expression (ip.geoip.country eq "US" and not cf.client.bot) and it will work.

Thank you for helping out @ncano! Very much appreciated.

Currently we have implemented a WAF custom rule
(ip.geoip.country eq “US” and not cf.client.bot)
And implemented a redirect script in the Custom HTML area.

It seems to work. Would this rise the issue your are mentioning above about bot score not being calculated yet?

Thank you for your help.

Happy to help! No concerns about your approach, bot score is already calculated by the time WAF phase runs, so you can indeed implement a redirect using WAF custom response.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.