How to block bad bots User-Agents in Cloudflare

Cloudflare provides a way to block bad bots under

Cloudflare block bad bot

If you want to block one bots that is allowed, you can block them by User Agent. To see what bots visit your website, see How to get list of User-Agent from access log. This will get list of all bots accessing your website from Apache, Nginx or similar webserver access log.

You can block visitors by User-Agent by going to

Click on “Create firewall rule”.

Cloudflare create firewall rule

On next page select following values

cloudflare create firewall rule

On this page, you can also add rule by click on “Edit expression” link, then pasting rule. I used following rule to block marketing/seo bots.

NOTE: Don’t use this rule without knowing what it does, you may not want to block all of these bots. Do your own research on what the bot does before blocking it from your website.

Related Posts

How to get list of User-Agent from access log
How to block Bad Bots (User Agents) using .htaccess

Back to Cloudflare

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *