> ## Documentation Index
> Fetch the complete documentation index at: https://docs.enclave.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Enclave in these docs is the code and cloud security platform at enclave.ai. It is not Open Enclave, Intel SGX or other hardware enclaves, or enclave.gg.
> People use Enclave in the web app at https://app.enclave.ai or the desktop app. These docs describe no public Enclave API or CLI, so don't invent endpoints, commands, or config files.
> Connecting an integration needs a person to sign in and approve access in a browser. Tell the user the exact step to take instead of saying you completed it.

# Cloudflare

> 使用只读 API 令牌连接 Cloudflare，让 Enclave 可以梳理你的区域、Workers 和 Pages 项目。

连接 Cloudflare，让 Enclave 可以看到你的 DNS、Cloudflare 代理了哪些主机名，以及其背后的 Workers 和 Pages 项目。访问是只读的。

## 开始之前

* 你需要拥有 Enclave 中的 **Owner** 或 **Admin** 角色。
* 在 Cloudflare 中，你需要是 **Super Administrator** 或拥有 **API Token Provisioning** 权限，才能创建账户 API 令牌。

## 创建令牌

**1. 创建自定义令牌**

在 Cloudflare 中，前往 **Manage Account → Account API Tokens** 并创建一个自定义令牌。将下面的每项权限都设置为 **Read**。

**2. 创建令牌**

点击 **Continue to summary**，然后点击 **Create Token**。

**3. 将令牌粘贴到 Enclave**

打开 **Settings → Integrations**，点击 **Cloudflare** 旁边的 **Connect**。粘贴令牌。Enclave 会检查令牌，并添加该令牌可以读取的每个 Cloudflare 账户。

| 部分 | 权限 | 范围 |
| - | - | - |
| Account & Billing | Account Settings | Account |
| Account & Billing | Account API Tokens | Account |
| DNS & Zones | Zone | Zone |
| DNS & Zones | DNS | Zone |
| Developer Platform | Worker Routes | Zone |
| Developer Platform | Workers Scripts | Account |
| Developer Platform | Pages | Account |
| Developer Platform | Workers CI | Account |
| Rules & Configuration | Origin | Zone |

如果缺少某项权限，Enclave 会指出它的名称，以便你编辑令牌。Enclave 会加密存储该令牌。

## Enclave 读取什么

* 区域和 DNS 记录，包括 Cloudflare 代理了哪些记录
* Worker 路由和源站规则
* Workers 及其自定义域名
* Pages 项目
* Workers Builds 触发器，用于将 Worker 与其仓库关联起来

在 Coverage 中，被代理的记录会显示 **Proxied by Cloudflare** 徽章。

Enclave 不读取 Transform Rules、Snippets 或 Cloudflare Access。使用 Wrangler 部署且没有 Workers Builds 触发器的 Worker 不会关联到仓库。

## 管理连接

打开 **Settings → Integrations → Cloudflare**。

* **Refresh status** 会再次检查令牌。如果令牌已被撤销、已过期或失去访问权限，账户会显示 **Reconnect needed**。粘贴新令牌即可修复。
* **Remove** 会将该账户及其区域、Workers 和 Pages 项目从 Enclave 中移除。Enclave 无法撤销令牌，因此请同时在 Cloudflare 中撤销它，除非另一个已连接的账户仍在使用它。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.