Cloudflare gives you a number of ways and settings to stop hackers from accessing your site.Sign in to Cloudflare with your passwords to get to your dashboard.
Decide on the right website: If your Cloudflare account is linked to more than one website, choose the website for which you want to block bots.
Go to the part called “Firewall”: Look in your Cloudflare dashboard for the “Firewall” tab or area and click on it.
Create a Firewall Rule: Click the “Create Firewall Rule” button to set up a rule that blocks the bots you want to block.
Set up the rule: In the Firewall Rule settings, you can choose from a number of options to tell the computer when the rule should take effect. This could include IP addresses, User-Agent strings, ASNs (Autonomous System Numbers), or any other useful information.
For example, you could make a rule that matches calls from IP addresses that look sketchy or from bots with known User-Agent strings.
Describe what happened: After setting up the conditions, you can choose what you want to happen when the rule is met. In this situation, you should stop the bots. Cloudflare gives you choices like “Block” and “Challenge” to deal with these kinds of problems.
Click “Block” to totally stop the bots from getting in.
Save the rule and put it into motion. Once you’ve set up the conditions and actions, you should save the rule. Cloudflare will ask you to confirm that the new rule should be put into place. Go ahead with the rollout to turn on the rule that will stop bots from accessing your website.
Test and improve: Keep an eye on the traffic to your website and look at the Firewall events to make sure the rule is working well. If you need to, make changes, like improving the conditions or adding more rules to catch certain kinds of bots.
Note that the steps may be a little different based on the version of the Cloudflare interface or any changes that have been made to the platform. Always check the Cloudflare documentation or help resources for the most up-to-date information on how to do things and what features are available.
some more ways and tools you can use in Cloudflare to stop bots
Rate Limiting: Cloudflare’s Rate Limiting tool lets you set limits on how many requests can come from a certain IP address or range of IP addresses in a certain amount of time. By setting rate limits, you can successfully block or slow down bot traffic that is too high.
Browser Integrity Check: Turn on Cloudflare’s Browser Integrity Check tool to make sure that the requests are coming from real web browsers and not from scripts or bots that do the work for you. This feature looks at the headers and characteristics of arriving requests to find out if they are acting in a strange or unusual way.
question-based actions: In addition to blocking bots, you can choose to question suspicious requests by showing a CAPTCHA or JavaScript challenge to see if the user is a bot or a person. This can be a good way to tell the difference between real people and automatic programs.
Bot Management: Cloudflare has a Bot Management tool that lets you find and block different kinds of bots in a more advanced way. It uses machine learning algorithms and techniques to tell the difference between good bots (like crawlers for search engines) and bad or unwanted bots.
IP Reputation Lists: Cloudflare lets you make IP reputation lists that you can use to block or challenge data from IP addresses that are known to be malicious. You can import IP reputation lists from third-party sources or directly add IP addresses that you want to block.
Firewall Rules with Custom Logic: Cloudflare’s Firewall Rules let you build custom logic based on a wide range of attributes, such as IP addresses, HTTP headers, request methods, and more. Using Cloudflare’s expression language, you can write custom rules with complex conditions and acts that are designed to block bots.
Bot Fight Mode: Cloudflare’s Bot Fight Mode is an advanced feature that uses behavior analysis to instantly find and block suspicious bot traffic. It uses signals from the Cloudflare network and machine learning algorithms to find and stop bots in real time.