Skip to content

With your permission, we use analytics and marketing tools to understand visits and improve this site. Read our data privacy policy.

Blog

How to block AI crawlers

Block AI crawlers with the control that matches your policy: robots.txt, verified network rules, rate limits, application enforcement, or challenges.

Frederick Jahn
Frederick JahnMarch 12, 2026
How to block AI crawlers

To block an AI crawler, first decide whether you want to state a crawl preference or deny the HTTP request. Use robots.txt for documented crawlers that honor the Robots Exclusion Protocol. Use a server, application, or edge rule when the request itself must be stopped.

There is no universal "block AI" switch. A rule that matches GPTBot will not cover a scraper pretending to be Chrome. A broad browser challenge may stop some automation while also interrupting readers. The right control depends on the client, the resource, and the cost of a wrong decision.

Choose the control by what you need to enforce

Start with the outcome, not the product feature.

GoalFirst control to considerWhat it does not solve
Tell a documented crawler not to fetch selected pathsrobots.txtA client that does not honor the protocol
Deny a verified named crawler at the request boundaryExact user-agent claim plus the operator's published verification methodUnidentified automation and traffic outside the published ranges
Reduce excessive retrieval without a full blockRate limit scoped to the resource and the strongest available identityDistributed clients if the key is only source IP
Protect subscriber, account, or internal contentAuthentication and application authorizationPublic-page scraping
Stop a suspicious interactive sessionBounded browser challenge followed by a short-lived decisionDirect HTTP clients and legitimate clients that cannot run the challenge
Apply several signals before serving public contentRequest classification at the edge or originThe need to choose a fallback for unknown or failed classifications

Do not deploy every control because it appears in the table. Each additional layer creates a new failure mode. Use the smallest combination that enforces the policy you actually chose.

Control matrix

ControlEnforcement pointMain coverageCommon bypass or limitReader impactOperational workFast rollback
robots.txtCrawler reads a public fileNamed clients that honor the protocolIt is not access authorizationNone for normal browsingKeep tokens and paths currentRemove or change the group
User-agent ruleServer, application, or edgeRequests making an exact named claimThe header can be copied or removedLow if narrowly scopedMaintain tokens and exceptionsDisable the rule
Verified-network ruleServer or edgeNamed clients with a published IP or DNS methodLists change; not every client publishes proofLow if identity mapping is exactRefresh and audit evidenceRestore the prior list or policy
Rate limitApplication, gateway, or edgeRepeated requests sharing the selected keyWeak keys split one actor or combine unrelated usersDepends on threshold and routeTune keys, windows, and budgetsRaise limit or bypass affected routes
Authentication and authorizationApplicationRestricted resources and state-changing actionsDoes not stop access to public pagesExpected login or entitlement flowMaintain access modelRestore prior permission rule
Browser challengeBrowser-facing edge or application routeInteractive clients that must execute the checkSome automation can complete it; non-browser clients cannotPotentially highPrevent loops and accessibility failuresSwitch to observe-only or bypass route

The enforcement point matters less than the decision quality. An edge rule can save origin work, but an application still owns subscriber entitlements and permissions for state-changing actions.

Block named crawlers with robots.txt

The Robots Exclusion Protocol lets a service publish groups of rules for crawler product tokens. A full-site preference for two documented model-development crawlers looks like this:

User-agent: GPTBot
Disallow: /

User-agent: ClaudeBot
Disallow: /

Use the exact current token from the operator's documentation. OpenAI documents separate controls for GPTBot and OAI-SearchBot, so blocking the training crawler does not require blocking the search crawler. OpenAI crawler documentation

Anthropic likewise documents separate rules for ClaudeBot, Claude-SearchBot, and Claude-User. Anthropic crawler documentation

Place the file at /robots.txt on each hostname covered by the policy. Test the served response rather than only the file in your repository. A CDN, framework, or redirect can change what a crawler receives.

RFC 9309 says crawlers are requested to honor the rules and states that those rules are not access authorization. The RFC also warns that listing a private-looking path in robots.txt makes the path public. Use authentication or another application security control for content that must stay restricted.

For syntax, matching, caching, and failure behavior, use the dedicated robots.txt guide.

Enforce a named-client block at the request boundary

If the server must deny a named crawler, a user-agent string alone is too weak. Any HTTP client can copy it. Combine the exact client claim with the verification method published for that client.

The policy logic should be explicit:

claim = match an exact configured crawler token
identity = verify the source using that client's configured method

if claim is blocked and identity is verified:
    deny with the configured response
else if claim exists and identity failed:
    apply the spoofed-claim policy
else if verification is unavailable:
    apply the preselected unknown-state fallback
else:
    continue to the next policy check

Take the source address from trusted infrastructure, not an unsanitized X-Forwarded-For header. Fetch range lists only from configured operator URLs. Bound download size, redirects, time, and accepted entries. Keep a last known-good list when a refresh fails.

Do not merge every range published by one company into a company-wide block. An operator may use separate networks for training crawlers, search crawlers, and user-triggered fetchers. How to verify AI agents covers these identity states and the operator-specific methods.

Rate-limit crawler traffic

Rate limiting is useful when some access is acceptable but its volume or pace is not. The hard part is the key.

Possible keys include:

  • verified crawler identity;
  • authenticated account or API credential;
  • first-party session;
  • source network or IP address;
  • route group;
  • a bounded combination of these fields.

An IP-only limit is easy to operate, but it can group unrelated clients behind one address and miss a distributed client using many addresses. A verified operator identity is better for named crawler budgets. Account or session keys are stronger for authenticated workflows.

Define the window, burst allowance, route scope, and response before launch. The 429 Too Many Requests status means the client sent too many requests in a given period. RFC 6585 allows a Retry-After header and deliberately leaves the counting method and client identity to the server.

Do not rate-limit every route equally. A cached public article, an expensive search endpoint, and a login action have different costs and abuse risks.

Enforce restricted content in the application

Use authentication and authorization for subscriber archives, account pages, paid APIs, preview systems, and internal routes. A crawler name should never grant access that the request's credentials do not have.

Apply the same rule to agentic clients. If an authorized user delegates a task to an agent, the agent still acts within that user's permissions. Verify every state-changing action, validate its input, and keep the normal abuse controls in place.

This control is less glamorous than fingerprinting, but it settles the most important question: can this request access this resource?

Use challenges only where a browser can complete them

A browser challenge can add evidence for a suspicious interactive session. It is a poor fit for a known crawler, feed reader, API client, or other software that is not supposed to execute a browser flow.

Scope challenges to routes where browser interaction is expected. Give a successful client a short-lived, integrity-protected pass. Prevent redirect and challenge loops. Define what happens when cookies, JavaScript, or accessibility requirements make the flow unavailable.

Start in observation mode. Measure how many real sessions would have been challenged and which routes produce ambiguous results. A technically working challenge can still be the wrong control if it sits in front of every article.

Validate before and after rollout

Run a small test matrix before enabling a block:

CaseExpected result
Verified crawler covered by the blockDenied on the intended paths with the documented reason
Verified crawler outside the blockPreserves its previous access
Copied crawler user agent from an unrelated sourceDoes not inherit verified identity
Client without a useful identityUses the configured unknown-client policy
Published range refresh failsKeeps the last known-good evidence and reports the dependency error
DNS verification times outUses the chosen temporary-failure fallback
Client supplies its own forwarding headerCannot change the source identity recorded at the trusted boundary
Reader on an affected routeCompletes the normal page or challenge flow without a loop
Restricted resource without credentialsRemains denied regardless of crawler identity

After rollout, watch request counts, response codes, bytes, cache behavior, origin load, challenge completion, and reader-facing errors. Break results down by policy reason. A falling crawler count can mean the block worked, the client changed identity, or the classifier stopped recognizing it.

Keep one canary route or a small traffic percentage in observe-only mode when the platform allows it. This gives you a comparison while the rule settles.

Roll back safely

Every blocking rule needs an owner, expiry or review date, and one-step rollback. Keep the previous rule set available. Record which routes and client classes the change affects.

Roll back or switch to observation when:

  • approved search or partner traffic is denied;
  • reader errors or challenge loops rise;
  • the verifier loses its current evidence source;
  • an overly broad key groups unrelated clients;
  • the origin or edge rule adds unacceptable failure behavior.

Do not delete the incident data after rollback. Preserve reason codes and the rule version so the next change addresses the actual miss.

The broader decision model is in How to control AI agent access. It separates identity, resource, behavior, and response instead of turning "AI" into one global block.

Where Centinel fits

Centinel helps teams identify and control automated traffic. During an evaluation, test how a crawler is identified, where the policy runs, what the unknown-state fallback is, and how quickly a rule can be disabled. Use traffic from your own site rather than assuming one control covers every crawler.

To build the inventory and test cases before enforcing a new block, request a site audit.

Sources