Country blocking and trusted bots

I’ve been using Cloudflare for a long time.

but over the last few months i’ve started to detect strange situations.

I had blocked all traffic (due to malicious bots) from outside the country I was in.

but i got this error: google search console and google news started not getting data from my website.

I couldn’t make any queries, especially in the google search console.

Then I did some research. I edited the country limitation field as follows.

however, it exists differently in the following rule.

Do I seem to have done something wrong?

my purpose; google etc. is that the right bots crawl my website correctly. Blocking all malicious bots.

Assuming that you want to block all traffic from outside of Turkey, with exception of verified bots, you’d want to use:

(ip.geoip.country ne "TR" and not cf.client.bot)

This would allow verified bots (i.e. GoogleBot), even if from outside of Turkey, while blocking traffic from outside of Turkey that isn’t a verified bot.

1 Like

@jwds1978

thanks…

The Expression Preview you sent is already the same as mine.

I understand what you want to say.

but I have stated before:

My goal is to prevent malicious bots from outside our country, but also to allow approved bots.

how can I do that?

As I said in my first response, the following will block all traffic from outisde of Turkey with exception of verified bots… Verified bots will be allowed while everything else from outside of the country will be blocked.

(ip.geoip.country ne "TR" and not cf.client.bot)

Are you trying to do something different‽ You said that you’d blocked all traffic from outisde of Turkey, but wanted to allow verified bots (i.e. GoogleBot), did you not‽

@jwds1978 thanks…

I’m really bothering you because I continue to have problems. I am sorry.

There is something strange going on.

The same code already exists as I said before.

but even today when i entered google search console, google couldn’t verify my account.

verified after disabling firewall rules.

There are 4 different rules apart from the permission I sent before.

I wonder if these others are blocking the entry of trusted bots?

The contents of all the currently active rules are as follows. (also bot fight mode is active)

Have you looked at the logs under Security » Overview » Activity Log in your Cloudflare dashboard to see what’s being blocked by what? The entries there will tell you what (i.e. firewall rule, hotlink protection, managed rule, etc.) blocked a particular request.