Home / Blog / Website Security / How do you keep bots off your website, and can Cloudflare help?
Answers

How do you keep bots off your website, and can Cloudflare help?

27 November 2026 · By John Carlsson
Keep bots off your website in layers. Use robots.txt to ask well behaved crawlers to stay out, then block or challenge the rest at the server or CDN, because robots.txt is not access control. Cloudflare can help: Bot Fight Mode is available on the free plan, paid plans add Super Bot Fight Mode, and its AI crawler policies let you block or allow AI bots.

To keep bots off your website, start by knowing which bots you have

Before you keep bots off your website, decide which bots you actually want gone. Not every bot is a problem. Search engine crawlers, uptime monitors and AI search crawlers can all bring benefits. The bots worth stopping are those that scrape content, try to log in, submit spam through forms or hit the server hard enough to slow it down. Before blocking anything, look at your server logs to see which user agents and IP addresses are making requests, how often and to which pages.

Remember that a user agent can be faked. Google recommends verifying its crawlers by running a reverse DNS lookup on the IP address, checking that the hostname ends in googlebot.com, google.com or googleusercontent.com, and then running a forward DNS lookup to confirm it returns the same address. Google also publishes its crawler IP ranges as JSON files.

Layer one: robots.txt for polite bots

A robots.txt file tells crawlers which parts of a site they may request. Well behaved bots follow it. For example, to ask one crawler to stay away from the whole site:

``` User-agent: ExampleBot Disallow: / ```

The limitation is important. The Robots Exclusion Protocol, published as RFC 9309, states that its rules are not a form of access authorisation. Bots that ignore it, which includes most malicious ones, are not affected. Some user triggered AI fetchers, such as OpenAI's ChatGPT-User, also state that robots.txt rules may not apply to them, because a person asked for the page.

Layer two: block at the server or CDN

To actually stop a bot, the request has to be refused before it reaches your application. You can do this in your web server configuration by IP address or user agent, but bad bots change both often, so a CDN or web application firewall is usually more effective.

What Cloudflare offers

Cloudflare documents bot protection by plan:

Cloudflare warns that false positives are expected with its bot modes, particularly in the first few days, and recommends reviewing Security Events and adjusting rules.

Layer three: protect the targets

Bots usually aim at the same few places. Put rate limits on login, search and contact form endpoints, add a challenge such as Cloudflare Turnstile to forms, and make sure error pages are cheap for the server to produce. These steps reduce harm even from bots that get past the first two layers.

A practical order of work

  1. Review your logs and list the bots that visit.
  2. Verify important search crawlers before you trust or block them.
  3. Use robots.txt to set out which crawlers are welcome.
  4. Turn on bot protection at your CDN, starting with the least aggressive settings.
  5. Add rate limits and form challenges.
  6. Check Security Events and your logs after each change, and allow anything blocked by mistake.

See which bots are visiting

Our Real Traffic Audit reads the access log you download from your host, entirely in your browser, and sorts each request into your own server, AI crawlers, search engines, headless browsers, other bots and you, then grades what is left as likely or confirmed people. That shows which bots are visiting before you decide what to allow or block.

Sources

Frequently asked questions

Will it hurt my SEO to keep bots off your website?

It can if you block the wrong ones. Search engines such as Googlebot need access to crawl and index your pages, and AI search crawlers such as OAI-SearchBot and PerplexityBot need access for your pages to appear in their answers. Verify a bot before blocking it, allow verified search crawlers, and test changes, because Cloudflare notes that its bot modes can produce false positives.

Why do fake bots claim to be Googlebot?

A user agent is just a text label that any program can send, so scrapers often copy Googlebot's to avoid being blocked. Google recommends checking the requesting IP address with a reverse DNS lookup, confirming it belongs to googlebot.com, google.com or googleusercontent.com, then running a forward lookup to confirm it matches. Google also publishes its crawler IP ranges.

💬 Got a problem?

aiwebpageseo.com is a data-driven SEO and AEO platform providing a free suite of technical website tools.