Sub topic 13
When you need enforcement, not etiquette
This chapter assumes you know how robots.txt rules work and what the AI crawler tokens (GPTBot, ClaudeBot, CCBot and others) stand for. It also assumes you can read an HTTP access log and edit a web server or CDN configuration. Earlier chapters separated advisory conventions from enforced controls. This chapter covers the controls that actually stop requests.
Why etiquette is not enough
robots.txt, llms.txt, meta tags, TDM-Reservation headers and content-usage preferences all work the same way. The publisher states a wish, and the crawler operator decides whether to honor it. A well-run operator usually does. A scraper that ignores the wish loses nothing, because the server still answers the request.
Advisory signals are enough when the content is public and you only want to steer reputable crawlers. They are not enough in these cases:
- The content is paid, licensed or private.
- A contract or legal requirement says the content must not be copied.
- Crawler traffic is raising your hosting costs or degrading the site for users.
- You have logs showing a crawler that ignores your
robots.txt.
In those cases, enforce the rule at the point where the request arrives.
Identity: a user-agent string proves nothing
The User-Agent header is text that the client chooses. Anyone can send GPTBot or Googlebot in it. Two consequences follow:
- A rule that allows traffic because of its user-agent can be abused by anyone who copies the string.
- A rule that blocks traffic because of its user-agent only stops crawlers that identify themselves honestly. A scraper can claim to be an ordinary browser.
Bot verification means checking a claim against something the client cannot fake. There are two common methods.
- Published IP ranges. Some operators publish the address ranges their crawlers use, usually as a JSON file. You compare the connecting IP to those ranges.
- Forward-confirmed reverse DNS. You look up the hostname for the connecting IP, check that it belongs to the operator's domain, then resolve that hostname and confirm it maps back to the same IP. This is the method Google documents for Googlebot. Not every AI operator supports it, so check each operator's documentation.
The script below implements both checks. The CIDR range is a documentation placeholder (192.0.2.0/24). Replace it with the ranges the operator currently publishes, and refresh them regularly because they change.
import ipaddress
import socket
def load_networks(cidrs):
"""Parse CIDR strings into network objects."""
return [ipaddress.ip_network(c) for c in cidrs]
def ip_in_ranges(ip, networks):
"""True if the IP falls inside any published range."""
addr = ipaddress.ip_address(ip)
return any(addr.version == n.version and addr in n for n in networks)
def forward_confirmed_dns(ip, allowed_suffixes):
"""Reverse-resolve the IP, check the domain, then resolve forward again."""
try:
host, _, _ = socket.gethostbyaddr(ip)
except (socket.herror, socket.gaierror):
return False
if not host.endswith(tuple(allowed_suffixes)):
return False
try:
_, _, addresses = socket.gethostbyname_ex(host)
except socket.gaierror:
return False
return ip in addresses
published = load_networks(["192.0.2.0/24"]) # placeholder range
for client_ip in ["192.0.2.15", "198.51.100.7"]:
print(client_ip, ip_in_ranges(client_ip, published))The loop prints True for 192.0.2.15 and False for 198.51.100.7. In production you would feed this check from your log pipeline or edge function. Treat a request that claims to be a known crawler but fails verification as hostile.
Rate limiting
Rate limiting caps how fast one client can request pages. It works even when you cannot identify the client, and it protects the origin server from any aggressive fetcher. It does not stop slow, patient copying.
The nginx configuration below limits only requests whose user-agent matches known AI crawlers. Requests with an empty key are not counted, so normal visitors are unaffected.
map $http_user_agent $ai_bot {
default 0;
"~*(GPTBot|ClaudeBot|CCBot|PerplexityBot)" 1;
}
map $ai_bot $ai_bot_key {
0 "";
1 $binary_remote_addr;
}
limit_req_zone $ai_bot_key zone=aibots:10m rate=30r/m;
server {
listen 80;
server_name example.com;
location / {
limit_req zone=aibots burst=10 nodelay;
limit_req_status 429;
root /var/www/html;
}
}This allows each matching client address 30 requests per minute, with a burst of 10. Excess requests receive 429 Too Many Requests. Well-behaved crawlers slow down when they see 429, and Retry-After can tell them when to return. Because the match is on the user-agent, a scraper that lies about it is not limited. For that case, key the limit on the address for all traffic, with a higher threshold.
WAF and CDN rules
A web application firewall (WAF) or CDN sits in front of your origin and can combine several signals in one rule. Typical signals are the user-agent, verified-bot status, IP reputation, autonomous system number (ASN), country, request rate and whether the client runs JavaScript.
Many CDN providers now offer a managed option for AI crawlers. The exact names and features differ by provider, so read your provider's current documentation before relying on one. Common patterns include:
- Block all declared AI training crawlers, and allow verified search crawlers.
- Challenge requests that claim to be a known bot but fail verification.
- Apply a stricter rate limit to unverified automated traffic than to verified bots.
- Return
402,403or429to bot traffic on paid sections of the site.
Always test a new rule in log-only mode first. Overbroad rules can block legitimate search crawlers and hurt your visibility in search results, or block monitoring and accessibility tools.
Authentication and paywalls
If content must not reach a crawler at all, put it behind authentication. A request without a valid session, token or API key gets 401 or 403 and no content. This is the only control in this chapter that does not depend on recognizing the client as a bot.
Some points to keep in mind:
- Authentication only protects content that is actually behind it. A preview page or an unauthenticated API endpoint still leaks.
- Content that a logged-in human can read can also be read by a logged-in scraper. Account creation limits, per-account rate limits and terms of service are the next layer.
- Do not serve full text to crawlers that identify as search bots while showing a paywall to humans, unless you use the search engines' documented paywall structured data. Showing crawlers different content from users can be treated as cloaking.
- Blocking a page at the edge also hides it from AI search and answer features. That is a business decision, not just a technical one.
Choosing a control
| Goal | Advisory control | Enforced control |
|---|---|---|
| Ask training crawlers to skip public pages | `robots.txt` token rules | WAF block on verified training bots |
| Stop a crawler that ignores `robots.txt` | None | IP block, ASN block or challenge |
| Protect origin capacity | `Crawl-delay` (honored by some crawlers only) | Rate limiting with 429 |
| Keep paid content private | `noindex`, `TDM-Reservation` | Authentication |
| Detect spoofed crawlers | None | Published IP ranges or reverse DNS check |
A workable approach
- State the requirement. Decide whether you want to express a preference, reduce load, or guarantee that certain content is not copied.
- Keep
robots.txtrules for crawlers that honor them. They cost little and work for the operators that matter most. - Add verification and rate limiting for any crawler that you allow, so traffic claiming to be that crawler can be checked.
- Use authentication for content that must stay private.
- Read your logs weekly at first. The next chapter covers how to do this with access logs. Adjust the rules based on what the traffic actually does.
Exercise
Your robots.txt disallows GPTBot, but your access log shows many requests with the user-agent "GPTBot" from addresses outside the ranges OpenAI publishes. Is the real GPTBot ignoring your rules? What should you do?
Show answer
Probably not. Requests from addresses outside the published ranges are most likely a scraper copying the GPTBot user-agent string, since that header is not authenticated. Verify the addresses against the published ranges, then block or challenge the unverified ones at the WAF or edge, and rate limit by address. Keep the robots.txt rule for the genuine crawler, which can only be asked and not forced.
Exercise
A section of your site contains licensed articles that you are contractually required to keep from being copied into AI training sets. Which single measure from this chapter fits that requirement best, and why is robots.txt alone not enough?
Show answer
Authentication (a login or paywall that returns 401 or 403 without valid credentials) fits best, because it blocks every client without relying on identifying it as a bot. robots.txt is advisory, so a crawler that ignores it still receives the content, and the requirement would not be met.