Bidirectional Crawl Gating: Orchestrating HTTP 406 Not Acceptable Signals with robots.txt Allowlists for Token-Efficient AI Context Delivery
Explore how HTTP 406 and robots.txt allowlists can gate AI crawlers, delivering token‑light JSON‑LD to constrained agents while preserving full semantic payloads for deep‑reasoning bots.
- Using Accept‑header negotiation with HTTP 406 lets servers serve token‑light JSON‑LD only to agents that declare limited processing capacity.
- Robots.txt allowlists can map specific user‑agents to lightweight subgraphs, reducing crawl‑budget waste and improving citation precision.
- Edge‑compute platforms (e.g., Cloudflare Workers, Fastly Compute@Edge) can enforce this gating with sub‑millisecond latency.
Understanding Bidirectional Crawl Gating
When an AI crawler requests a resource, the server can inspect the Accept header and, if the header indicates a limited token budget, respond with HTTP 406 Not Acceptable, prompting the crawler to retrieve a lightweight JSON‑LD subgraph defined in a robots.txt allowlist.
RFC 7231 defines the semantics of the 406 status; it signals that the server cannot produce a representation matching the Accept criteria. By coupling this with a robots.txt rule that lists a dedicated sub‑path (e.g., /lite‑graph/), the server creates a bidirectional contract: the crawler knows when to fall back to a minimal semantic payload, and the site preserves full‑fidelity data for agents that request it.
- Map each AI user‑agent to a distinct sub‑path in robots.txt using the Allow directive.
- Define Accept header patterns (e.g., application/ld+json;profile="lite") that trigger the 406 response.
- Document the contract in /llms.txt so downstream indexing services can discover the gating logic.
Implementing Accept Header Validation with robots.txt Allowlists
Edge logic can examine the incoming Accept header, compare it against a whitelist of profiles, and either serve the full HTML+JSON‑LD bundle or return 406 with a Location header pointing to the lightweight graph path.
On Cloudflare Workers, a simple JavaScript snippet can read request.headers.get('Accept'), match against a RegExp for "profile=lite", and invoke fetch(`${url}/lite-graph/`) while preserving the original request method and cookies.
- Deploy a VCL snippet in Varnish: if (req.http.Accept ~ "lite") { return (synth(406, "Redirect to /lite-graph")); }
- In NGINX, use if ($http_accept ~* "lite") { return 406; } and configure error_page 406 = @lite_graph;
- Update robots.txt: User-agent: PerplexityBot\nAllow: /lite-graph/\nDisallow: /full-graph/.
Edge Compute Patterns for Token-Constrained AI Agents
A CDN edge can cache both the full and lite representations, ensuring that the 406 negotiation incurs no additional origin latency; the edge simply rewrites the response based on the Accept header.
Because AI crawlers often respect Cache‑Control: max-age directives, setting a short TTL (e.g., 300 seconds) on the lite graph prevents stale token‑budget data while allowing frequent updates for dynamic content.
- Configure separate cache keys: one keyed by "full" and another by "lite" Accept profiles.
- Leverage Fastly’s Surrogate‑Key header to purge both representations simultaneously when schema.org markup changes.
- Log 406 occurrences in a monitoring pipeline (e.g., OpenTelemetry) to audit crawl budget utilization.
Frequently Asked Questions
How does a 406 response differ from a 403 for AI crawlers?
A 406 signals content‑negotiation failure and invites the client to request an alternative representation, whereas a 403 explicitly denies access.
Can robots.txt block a crawler from the lite subgraph?
Yes; a Disallow rule for the lite path will prevent the crawler from following the fallback, forcing it to accept the full payload or stop crawling.
Benchmark your domain across ChatGPT, Perplexity & Claude
Inspect live AI citations, bot crawler telemetry, and schema readiness in a single pass.