# 将一些CloudFlare路径添加到robots.txt，以避免爬虫程序错误地检查

**URL:** https://meta.discourse.org/t/add-to-robots-txt-some-cloudflare-path-to-avoid-crawlers-inspect-incorrectly/242561
**Category:** Development
**Created:** [2022年十月21日 07:59 UTC](https://meta.discourse.org/t/add-to-robots-txt-some-cloudflare-path-to-avoid-crawlers-inspect-incorrectly/242561 "2022-10-21T07:59:04Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![albertoiNET](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/albertoinet/32/277536_2.png) [@albertoiNET](https://meta.discourse.org/u/albertoiNET)
#### Post date: [2022年十月21日 07:59 UTC](https://meta.discourse.org/t/add-to-robots-txt-some-cloudflare-path-to-avoid-crawlers-inspect-incorrectly/242561/1 "2022-10-21T07:59:04Z")

</div>

首先，我想解释一下，有些网站依赖 CloudFlare 而不是 Discourse 来增加额外的安全层。这一层提供了一些功能，如电子邮件混淆和反机器人挑战，它使用虚拟路径，例如：

- [JavaScript 检测](https://developers.cloudflare.com/bots/reference/javascript-detections/)，由 Cloudflare 机器人产品使用（`example.com/cdn-cgi/challenge-platform/`）
- [Web 分析](https://developers.cloudflare.com/analytics/web-analytics/getting-started/#sites-proxied-through-cloudflare)，用于通过 Cloudflare 代理的网站（`example.com/cdn-cgi/rum`）
- [图像大小调整](https://developers.cloudflare.com/images/image-resizing/url-format/)，用于您将用于图像的新 URL（`example.com/cdn-cgi/image/`）
- [电子邮件地址混淆](https://support.cloudflare.com/hc/articles/200170016)（打开外部链接），用于隐藏电子邮件地址免受恶意机器人的侵害（`example.com/cdn-cgi/l/email-protection`）

在 CloudFlare 的[文档](https://developers.cloudflare.com/fundamentals/get-started/reference/cdn-cgi-endpoint/)中，建议禁止使用此虚拟路径 `/cdn-cgi/`，以避免爬虫和搜索引擎检查该路径。

本主题的主要目的是，我想通过添加一个新的 PR 来为 Discourse 的开发做出贡献，但 **我首先应该询问这是否是 Discourse 的一个合适功能** 。

感谢所有人的帮助。

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2022年十月21日 14:02 UTC](https://meta.discourse.org/t/add-to-robots-txt-some-cloudflare-path-to-avoid-crawlers-inspect-incorrectly/242561/2 "2022-10-21T14:02:32Z")

</div>

Cloudflare 的加速功能经常会破坏 Discourse。我认为这些都无关紧要。
