How to block bots on your website: what each method stops, and what gets past it

robots.txt only asks crawlers to stay away. Blocking bots that ignore it takes verified crawler lists, edge rules, and checks on the network, device and behaviour behind each request.

Chris Taylor
Chris Taylor

9 min read

Blocking bots means refusing requests from software you do not want on your site: scrapers, credential-stuffing tools, scalpers' checkout scripts, spam bots and, if you choose, AI crawlers. It does not mean blocking all automation. Search engines, uptime monitors and some AI assistants are bots you want, and bad bots made up 37% of all internet traffic in 2024 according to Imperva's 2025 Bad Bot Report, so the job is sorting the two rather than shutting the door.

This guide goes through the usual methods in order of effort, says what each one stops, and explains what gets past it.

MethodWhat it stopsWhat gets past it
robots.txtSearch engines and AI crawlers that choose to follow itAny bot that ignores it
Verifying crawlers by published IP listScrapers using a well-known crawler's nameBots that do not claim to be a crawler
Rate limits and WAF rulesHigh-volume bots from a few addresses, malformed requestsBots spread across residential proxies that copy a real browser
CAPTCHA on formsAutomated form spam, and solving services if the CAPTCHA checks who solved itAnything that never loads the form, such as scrapers and API scripts
Detection at the edgeBots in real or modified browsers, on pages and APIsVery little consistently, because it has to fake the network, device and behaviour all at once

Decide which bots you want first

Every blocking decision depends on this list, so write it down before changing anything.

Bot typeExamplesWhat blocking it does
Search engine crawlersGooglebot, BingbotRemoves you from search results
AI training crawlersGPTBot, ClaudeBot, CCBotKeeps your content out of model training; a business decision
AI search and assistant fetchersOAI-SearchBot, ChatGPT-User, Claude-User, PerplexityBotStops those assistants finding and citing you
Services you useUptime monitors, payment callbacks, partner integrationsBreaks the service
Everything else that is automatedScrapers, credential-stuffing tools, spam bots, checkout scriptsWhat you want to block

How to detect AI agents lists the main AI crawlers and agents and how to verify each.

robots.txt asks crawlers to stay away, but does not block them

A robots.txt file at the root of your site tells crawlers which paths they may fetch. The crawlers that follow it are the ones run by companies with a reputation to keep: search engines and the main AI companies. To ask the main AI training crawlers to stay away from your whole site:

User-agent: GPTBot
Disallow: /

User-agent: ClaudeBot
Disallow: /

User-agent: CCBot
Disallow: /

User-agent: Google-Extended
Disallow: /

Google-Extended is a token rather than a crawler: Google reads it to decide whether pages Googlebot fetched may be used for Gemini, so disallowing it does not affect search. Our own logs show AI crawlers read robots.txt far more often than any other file meant for them, as our llms.txt study found.

robots.txt does nothing against a bot that chooses to ignore it, and the bots you most want to stop are exactly those. It is the polite first step, not a defence.

Verify any crawler you allow

A user agent is a line of text the client chooses, so a scraper can call itself Googlebot or GPTBot. Before you allow a crawler by name, confirm the request really comes from its operator:

OperatorCrawlersHow to verify
GoogleGooglebotReverse DNS lookup on the requesting IP address, as Google documents
MicrosoftBingbotReverse DNS lookup on the requesting IP address, as Bing documents
OpenAIGPTBot, OAI-SearchBot, ChatGPT-UserPublished IP ranges, for example openai.com/gptbot.json
AnthropicClaudeBot, Claude-SearchBot, Claude-UserPublished IP ranges at claude.com/crawling/bots.json
PerplexityPerplexityBot, Perplexity-UserPublished IP ranges, for example perplexity.ai/perplexitybot.json

Allow requests whose name and address both match, and block any that use a crawler's name from an address outside its list. Borrowing a well-known crawler's name is common: between 5 and 18 October 2026, 53% of the 17,935 requests to prosopo.io that carried an AI crawler's user agent came from addresses that did not belong to the company named, as how to detect AI agents sets out.

AI agents that browse on a person's behalf, such as ChatGPT Agent, are harder, because many run a real browser from addresses that no published list covers. How they behave on the page is a better guide than where they connect from. An independent study of scroll behaviour, which was discussed on Hacker News, measured how bursty the scrolling of people and AI browsing agents was in the public dataset from the FP-Agent paper. People scrolled in bursts and agents did not, and a model using scroll timing alone told them apart 73.4% of the time, confusing people mainly with ChatGPT Agent. Scrolling on its own is not enough, but it shows why behaviour belongs in the decision.

Server, WAF and CDN rules stop the obvious traffic

Rules on your web server, web application firewall or CDN refuse requests before your application handles them.

RuleWhat it doesWhat gets past it
Rate limitsCaps how many requests one address, session or account makes in a period, set per endpoint so a login form can be stricter than a product pageBots spread across thousands of residential proxy addresses, each staying under the limit
Address and network blocksRefuses hosting providers, known VPN and proxy exits, or countries you do not serveResidential and mobile proxies; real people on shared networks are caught by mistake
Request rulesRefuses malformed requests, missing headers and paths no real visitor usesBots that copy a real browser's headers

These are cheap and worth having, but they work on things an attacker controls, so check what a rule would catch before you enforce it.

A CAPTCHA protects your forms, and a good one spots solving services

A CAPTCHA checks each visitor before a form is accepted, and a modern one lets most real visitors through without showing them a puzzle. It stops most automated form spam on its own. Attackers going after logins, sign-ups and checkouts sometimes pay CAPTCHA solving services to pass the challenge for them using people or software, so a CAPTCHA that only checks whether the challenge was answered can be beaten. A CAPTCHA that also checks who solved it can catch them, because solving services leave traces:

TraceWhy it shows up
Proxies and relayed connectionsThe challenge is solved on a worker's device and the answer is used from the bot's own connection, often through a proxy, so where it was solved and where the form is submitted do not match
TimingSending a challenge out to a service and back takes a different amount of time, with a different rhythm, from a person filling in the form themselves
Repeated devicesWorkers solve challenges for many sites from the same devices, so one device appearing across unrelated sites and sessions stands out

Proof-of-work challenges add a cost to each attempt and work best alongside these checks.

A CAPTCHA protects the forms it is placed on. Scrapers and scripts that call your API directly never load a form, so those routes need checks at the edge as well.

What serious bot detection looks at

Bots that get past the methods above usually run a real browser engine, often a commercial anti-detect browser that has been modified to remove the traces automation normally leaves, and they connect through residential or mobile addresses. Telling them apart from customers takes evidence from several layers at once:

EvidenceWhat it showsHow hard it is to fake
The network connectionHow the connection and its encryption were set up, which is characteristic of the software and operating system that opened itHard, because it has to match everything else the client claims
The address behind itHome broadband, mobile, business, hosting, VPN, proxy or Tor, and what the address has done beforeEasy to rotate with residential proxies
The request headersWhether the headers agree with each other and with the claimed browserEasy to copy from a real browser
The browser and deviceWhether the claimed browser and platform have the features of that version, and whether text and graphics render as the claimed hardware wouldModerate; anti-detect browsers edit much of it
The hardware underneathTiming measurements that differ between consumer devices and servers, virtual machines or containersHard, because a browser cannot change how fast its processor runs
Traces of remote controlChanges that automation and remote-control tools make to the page environmentModerate; tools built to hide them remove many
BehaviourThe timing, rhythm and order of mouse, touch, keyboard and scroll inputHard to fake across a whole session
RepetitionHow often the same address, device or account returns, and how many browsers share one deviceCostly, because it means paying for more real devices
Solving services and farmsRelayed connections and many near-identical sessionsHard while the work is done somewhere else

Two of these are worth a closer look. Residential proxies make the address weaker than it looks: in one attack we measured, 131,819 residential IP addresses sent 1.4 million attack requests, but all of them came from just 8 TLS fingerprints and 14 user agents. And hardware is hard to disguise: SIMD instruction timing is one example, because a modified browser can report any number of processor cores but cannot change how long the processor takes to run the same instruction, as we explain in faking browsers is easy, but not at scale. Behaviour can also separate people from AI agents, as the scroll study above found.

No one of these is reliable on its own, and a well-built bot can make any single signal look right. The strength is in checking that they agree. A browser that claims one operating system but connects like another, or claims a phone but times like a server, is hard to fake consistently, because the network stack and the hardware are not something a modified browser can change. Checks that read only what JavaScript reports lose to browsers patched to report whatever the attacker likes.

Where to run the checks

Run checks at your CDN edge if you can, in front of every page and API endpoint, so a request is refused before it reaches your servers and costs you compute. Checks inside a form widget only see the visitors who reach that form.

Start in a preview mode that records what would be blocked without blocking it. A week or two of real traffic shows which rules catch customers, and it is much easier to fix those before they cost you a sale. Challenge visitors you are unsure about rather than blocking them, and keep a readable reason for every block, because the first time a real customer is refused, someone will need to explain why.

Bot blocking checklist

  1. List the bots you want, and allow them by verified identity, not by name.
    • Include search engines, the AI crawlers and assistants you want citing you, uptime monitors, payment callbacks and partner integrations.
    • Record how each one is verified: reverse DNS for Googlebot and Bingbot, published IP ranges for the AI crawlers.
  2. Use robots.txt to set your policy for search and AI crawlers.
    • Add a User-agent and Disallow block for each AI crawler you do not want, such as GPTBot, ClaudeBot and CCBot, and the Google-Extended token for Gemini training.
    • Leave search crawlers alone unless you mean to drop out of search.
  3. Block requests that use a known crawler's name from outside its published addresses.
    • Refresh the vendors' IP range files regularly, because they change.
    • Log what this rule blocks for a week before enforcing it, to catch any proxy or CDN in front of the real crawler.
  4. Rate-limit per endpoint, with tighter limits on login, sign-up, password reset and checkout.
    • Count per account, session and device as well as per IP address, so a bot rotating proxy addresses still hits a limit.
    • Rate-limit failed logins across the whole endpoint, not only per account.
  5. Put a CAPTCHA on the forms that matter, choosing one that checks who solved the challenge as well as the answer.
    • Verify every token on your server, and make sure each one can be used once and expires quickly.
    • Pass the visitor's IP address with the token when you verify it, so a token solved somewhere else can be refused.
  6. For pages and APIs bots target directly, add detection at the edge that compares network, device and behaviour evidence.
    • Cover the API routes your apps call as well as your web pages.
    • Decide per route whether a doubtful request is challenged or blocked.
  7. Run new rules in preview first, and record a reason for every block.
    • Review what a rule would have caught before it blocks anything, and look for real customers among it.
    • Keep the reason with each blocked request, so support can answer a customer who was refused.

How Prosopo blocks bots

Prosopo Protect runs at your edge on Cloudflare Workers or AWS Lambda@Edge, in front of every page and API you choose. It checks the network, device and behaviour evidence described above on each request, allows verified good bots, and lets you set rules for AI agents. It starts with 14 days in preview mode, so you see what it would block on your own traffic before it blocks anything, and every block carries a reason your team can read. Pricing is published on the pricing page, with traffic not metered.

For forms, Procaptcha checks the same network, device and behaviour evidence as well as the answer, and its IP validation rules can reject a token used from a different country, city or network from the one that solved it. It is free for 10,000 requests a month. For particular attacks, see scraping, credential stuffing and spam bot protection.

Bots getting through your current rules?

A Bot Exposure Assessment is a 30-minute call with an engineer. We look at your traffic, show where your current setup leaves gaps, and agree how a trial would be judged. Nothing to install first.

Questions

Something else? Ask an engineer.

How do I block bots on my website?

Start by deciding which bots you want: search engines and some AI crawlers bring visitors, and blocking them costs you traffic. Use robots.txt to tell well-behaved crawlers what to avoid, verify any crawler you allow against the operator's published IP list, add rate limits and edge rules for obvious abuse, and put a check in front of the pages and API endpoints that matter. Bots that ignore robots.txt and fake a browser need detection that looks at the network connection, the device and the visitor's behaviour together.

Does robots.txt block bots?

No. robots.txt is a request, not a block. Search engines and the main AI crawlers such as GPTBot and ClaudeBot follow it, but a scraper or attack tool simply ignores it. To stop a bot that ignores robots.txt you have to refuse its requests, at your server, your WAF or your CDN edge.

How do I block GPTBot and other AI crawlers?

Add a Disallow rule for each crawler's user agent in robots.txt, for example GPTBot, ClaudeBot, PerplexityBot, CCBot and the Google-Extended token. OpenAI, Anthropic and Perplexity follow these rules. Because anyone can copy those names, also check that requests using them come from the IP ranges each company publishes, and block requests that claim a crawler's name from anywhere else.

Can bots get past a CAPTCHA?

Paid solving services can get past a CAPTCHA that only checks whether the challenge was answered, by passing it to people or software. A CAPTCHA that also checks how and where the challenge was solved can detect them, because solving services leave traces: the answer is often used from a different connection or proxy than the one that solved it, the timing differs from a person filling in the form, and the same worker devices turn up across many unrelated sites.

How do I block bots without blocking real customers?

Run new rules in a mode that logs what they would block before you enforce them, look at what they catch, and challenge doubtful visitors rather than blocking them outright. Allow the good bots you rely on by verified identity, not by user agent, and record a reason for every block so you can explain it when a real customer complains.