Skip to content

Commit acc8aff

Browse files
feat: add WAF ruleset to allow AI crawlers to LLM documentation files
- Add cloudflare_ruleset to bypass WAF checks for /llms.txt, /llms-short.txt, and /llms-full.txt paths - Enables AI fetch bots to access LLM documentation without triggering bot protection - Uses custom firewall phase to skip current ruleset for specified paths
1 parent 77b719d commit acc8aff

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

infra/main.tf

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,26 @@ resource "cloudflare_workers_route" "nightly" {
104104
script = cloudflare_workers_script.router.script_name
105105
}
106106

107-
# --- 5. Email Routing Setup ---
107+
# --- 5. Allow AI crawlers to LLM documentation files ---
108+
resource "cloudflare_ruleset" "allow_llm_crawlers" {
109+
zone_id = var.zone_id
110+
name = "Allow AI crawlers to LLM txt files"
111+
description = "Bypass WAF and bot checks for AI fetch bots accessing LLM documentation files"
112+
kind = "zone"
113+
phase = "http_request_firewall_custom"
114+
115+
rules = [{
116+
action = "skip"
117+
action_parameters = {
118+
ruleset = "current"
119+
}
120+
expression = "(http.request.uri.path in {\"/llms.txt\" \"/llms-short.txt\" \"/llms-full.txt\"})"
121+
description = "Allow AI crawlers to access LLM documentation files"
122+
enabled = true
123+
}]
124+
}
125+
126+
# --- 6. Email Routing Setup ---
108127

109128
resource "cloudflare_email_routing_settings" "main" {
110129
zone_id = var.zone_id

0 commit comments

Comments
 (0)