agentgrade

EnglishEspañol日本語中文
← Knowledge Base

问题

Cloudflare 的托管质询(机器人防护)会阻止自动化 HTTP 请求 —— 包括来自 AI 代理的请求。如果您的网站使用默认设置部署在 Cloudflare 后面,代理将无法访问您的 API 端点、支付网关或发现文件。

agentgrade 会逐项探测检测此问题。当某项检查被阻止时,您将看到"Blocked by Cloudflare"而非通过/失败结果。您的评分可能偏低,不是因为缺少能力,而是因为 Cloudflare 阻止了验证。

什么会被阻止

Cloudflare 的质询会在以下请求条件下触发:

这意味着每个面向代理的端点都可能被阻止:MCP、OpenAPI、llms.txt、x402.json、支付网关等。

如何修复

方案 1:对 API 路径绕过质询(推荐)

在 Cloudflare 的 WAF 规则中,创建一条规则,对面向代理的路径跳过托管质询:

表达式:

(http.request.uri.path matches "^/\\.well-known/.*" or
 http.request.uri.path matches "^/api/.*" or
 http.request.uri.path eq "/mcp" or
 http.request.uri.path eq "/openapi.json" or
 http.request.uri.path eq "/llms.txt" or
 http.request.uri.path eq "/agents.txt" or
 http.request.uri.path eq "/skills.json" or
 http.request.uri.path eq "/robots.txt")

操作: Skip → Managed Challenge

这样可以在 HTML 页面上保留机器人防护,同时允许代理访问面向机器的端点。

方案 2:将特定 User-Agent 加入白名单

创建一条 WAF 规则,对已知的代理 User-Agent 跳过质询:

(http.user_agent contains "agentgrade" or
 http.user_agent contains "Claude" or
 http.user_agent contains "GPTBot")

方案 3:使用 Cloudflare 的 Bot Management 层级

Cloudflare Enterprise 和 Business 计划提供更精细的机器人管理,能够区分"善意机器人"(API 客户端、代理)和恶意机器人。

验证修复

更新 Cloudflare 规则后,在 agentgrade 上重新扫描您的网站。之前被阻止的检查项现在应该显示通过/失败结果,而不是"Blocked by Cloudflare"。