> For the complete documentation index, see [llms.txt](https://www.axisnow.io/zh/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.axisnow.io/zh/docs/multi-edge/use-cases/cloudflare-multi-cdn.md). Agents can also search and read this documentation through its [MCP server](https://www.axisnow.io/zh/docs/~gitbook/mcp).

# 将 Cloudflare 升级为多 CDN

Cloudflare 与其他 CDN 组成多 CDN 的完整做法：按域名的 DNS 和 zone 状态选择一键解锁、Partial Setup 或父 zone 接入，再加入第二家 CDN，按地区分流、质量优选或主备容灾

## 适用场景 <a href="#when-to-use" id="when-to-use"></a>

让 Cloudflare 和另一家 CDN 共同承载同一个域名，由 AxisNow 按地区、质量或主备调度流量。出发点通常是下面两种之一：

* **站点已经接入在 Cloudflare 上**：不想离开 Cloudflare，希望再加一家 CDN，改善部分地区的访问，或在 Cloudflare 不可用时有另一家可以切换。
* **站点还不在 Cloudflare 上**：想把 Cloudflare 作为其中一家边缘，加入多 CDN 架构。

## 架构 <a href="#architecture" id="architecture"></a>

<figure><img src="https://3062891322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKDgGNU6JXG7cqYCk2aCz%2Fuploads%2Fgit-blob-4e5db95dc820d7b36f838db51d18b1c05364145e%2Fuse-case-cloudflare-multi-cdn.png?alt=media" alt="Cloudflare 多 CDN 架构：域名指向服务 CNAME，聚合边缘按路由规则把访客调度到 Cloudflare 或第二家边缘（CloudFront、ESA、EdgeOne、AxisNow 边缘任选一家），两家回源到同一个源站"><figcaption></figcaption></figure>

域名通过服务 CNAME 接入 AxisNow，访客走哪一家由路由规则决定。站点原本就在 Cloudflare 上时，Cloudflare 及 zone 上的配置保持不变，只是从唯一的入口变成被调度的其中一家。

## 配置步骤 <a href="#steps" id="steps"></a>

整个过程分三步：把 Cloudflare 接入服务，添加第二家边缘，配置路由规则。

### 1. 选择接入方式 <a href="#access-methods" id="access-methods"></a>

Cloudflare 以哪种方式接入服务，取决于业务域名在 Cloudflare 上的状态：DNS 是否托管在 Cloudflare；DNS 在其他服务商时，域名所在的 zone 是否已添加到 Cloudflare。

<figure><img src="https://3062891322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKDgGNU6JXG7cqYCk2aCz%2Fuploads%2Fgit-blob-e06a4de15c18f8be9b2614afc6efbebc03274fa8%2Fcloudflare-access-methods.png?alt=media" alt="选择 Cloudflare 接入方式的判断树：域名的 DNS 托管在 Cloudflare 且记录为 Proxied，用一键解锁 Cloudflare CNAME 接入，在快速入门中进入向导；DNS 在其他服务商时再看域名所在的 zone 是否已添加到 Cloudflare，已添加且为 Partial Setup 的用 Cloudflare Partial Setup 接入，还没有添加的用 Cloudflare 父 zone 接入。后两种不能一键解锁，先创建服务再把 Cloudflare 加入服务"><figcaption></figcaption></figure>

<table data-search="false"><thead><tr><th>域名的情形</th><th width="300">接入文档</th></tr></thead><tbody><tr><td>DNS 托管在 Cloudflare（Full Setup），记录为 Proxied</td><td><a href="https://www.axisnow.io/zh/docs/multi-edge/getting-started/unlock-cloudflare.md">一键解锁 Cloudflare CNAME 接入</a></td></tr><tr><td>DNS 在其他服务商，zone 以 Partial（CNAME）Setup 加入了 Cloudflare</td><td><a href="https://www.axisnow.io/zh/docs/multi-edge/use-cases/cloudflare-multi-cdn/partial-setup.md">Cloudflare Partial Setup 接入</a></td></tr><tr><td>DNS 在其他服务商，域名还没有添加到 Cloudflare</td><td><a href="https://www.axisnow.io/zh/docs/multi-edge/use-cases/cloudflare-multi-cdn/parent-zone.md">Cloudflare 父 zone 接入</a></td></tr></tbody></table>

一键解锁在向导里一并完成集成 Cloudflare 账号和创建服务。后两种不能一键解锁，需要先[集成 Cloudflare](https://www.axisnow.io/zh/docs/multi-edge/integrations/cloudflare.md) 账号、创建服务，再把 Cloudflare 加入服务。

另有两种情况：

* **DNS 托管在 Cloudflare，但记录是 DNS only，或还没有记录**：不能一键解锁。按[分步骤配置](https://www.axisnow.io/zh/docs/multi-edge/getting-started/step-by-step-configuration.md)创建服务后，以配置同步（Provision）方式加入 Cloudflare 即可：AxisNow 在域名自己的 zone 内创建同名的 Custom Hostname，不改动现有记录，您按控制台列出的记录完成域名验证。
* **站点由 Cloudflare Workers 提供**：同样使用一键解锁，对 Worker 绑定方式的要求和向导中的不同之处见 [Cloudflare Workers 站点](https://www.axisnow.io/zh/docs/multi-edge/use-cases/cloudflare-multi-cdn/workers.md)。

按对应的文档完成接入后，服务已经存在，Cloudflare 是其中的边缘提供商；以一键解锁接入的，此时流量仍全部走 Cloudflare。

### 2. 添加第二家边缘 <a href="#step-add-edge" id="step-add-edge"></a>

在服务的 **边缘提供商** 标签页点击 **添加边缘提供商**，见[边缘提供商](https://www.axisnow.io/zh/docs/multi-edge/services/edge-providers.md)。

* 新接入一家：先[集成](https://www.axisnow.io/zh/docs/multi-edge/integrations.md)它的账号，再以配置同步（Provision）方式加入，并为域名选择证书。各家需要提前准备的内容见[第二家边缘的准备](#second-edge-prerequisites)。
* 域名已经在另一家 CDN 上运行：以仅调度（Steer）方式加入，填写它的接入地址即可。

<figure><img src="https://3062891322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKDgGNU6JXG7cqYCk2aCz%2Fuploads%2Fgit-blob-7e1def9e580266d5c23aa2ebdbb01ba95a8e2ea2%2Fedge-providers-cloudflare-axisnow.png?alt=media" alt="服务的边缘提供商列表：点击添加边缘提供商加入第二家，图中 AxisNow 边缘与 Cloudflare 均已生效"><figcaption></figcaption></figure>

加入后、配置路由规则之前，先按[测试与验证](https://www.axisnow.io/zh/docs/multi-edge/services/edge-providers/testing.md#test-before-dns-switch)确认这家边缘能正常返回站点内容。

### 3. 配置路由规则 <a href="#step-routing" id="step-routing"></a>

新加入的边缘不会自动承载流量，需要在 **流量调度** 标签页把它加入规则。用哪种调度方式，见[选择调度方式](#choose-routing)。

<figure><img src="https://3062891322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKDgGNU6JXG7cqYCk2aCz%2Fuploads%2Fgit-blob-f2d2698c9fca7b7ecf760cdf7c78c007f1e82f53%2Funlock-cloudflare-13.png?alt=media" alt="流量调度标签页：默认和中国两条质量优选规则，在 Cloudflare 与 AxisNow 边缘之间调度"><figcaption></figcaption></figure>

## 第二家边缘的准备 <a href="#second-edge-prerequisites" id="second-edge-prerequisites"></a>

以配置同步方式加入之前，按所选的边缘完成对应的准备：

<table data-search="false"><thead><tr><th width="190">边缘</th><th>加入前需要准备</th><th width="230">集成文档</th></tr></thead><tbody><tr><td>CloudFront</td><td>不需要预先创建资源，AxisNow 为服务新建一个 distribution；业务域名不能已绑定在其他 distribution 上</td><td><a href="https://www.axisnow.io/zh/docs/multi-edge/integrations/cloudfront.md">集成 CloudFront</a></td></tr><tr><td>阿里云 ESA</td><td>业务域名所属的站点已在 ESA 中创建并完成验证，AxisNow 不会创建站点</td><td><a href="https://www.axisnow.io/zh/docs/multi-edge/integrations/esa.md">集成阿里云 ESA</a></td></tr><tr><td>腾讯云 EdgeOne</td><td>业务域名所属的站点已在 EdgeOne 中创建并完成验证，AxisNow 不会创建站点</td><td><a href="https://www.axisnow.io/zh/docs/multi-edge/integrations/edgeone.md">集成腾讯云 EdgeOne</a></td></tr><tr><td>AxisNow 边缘</td><td>边缘租户中已部署节点，并有一个已配置路由规则的调度域名</td><td><a href="https://www.axisnow.io/zh/docs/multi-edge/integrations/axisnow.md">集成 AxisNow 边缘</a></td></tr></tbody></table>

## 选择调度方式 <a href="#choose-routing" id="choose-routing"></a>

下表按站点原本运行在 Cloudflare 上来写；Cloudflare 是后加入的一家时，把两家的位置对调即可。

<table data-search="false"><thead><tr><th width="190">场景</th><th width="280">路由规则</th><th>效果</th></tr></thead><tbody><tr><td>部分地区访问慢</td><td>默认规则保持 Cloudflare；为该地区新建一条规则，第二家边缘为主用，Cloudflare 为备用</td><td>该地区的访客走第二家，其余访客不变。地域可以是大洲、国家或地区、中国运营商</td></tr><tr><td>需要灾备</td><td>默认规则改为主备，Cloudflare 为主用，第二家为备用</td><td>平时全部走 Cloudflare，它不可用时切到第二家，恢复后切回</td></tr><tr><td>质量优选</td><td>规则改为质量优选，两家都加入</td><td>按拨测评分择优，评分领先明显且稳定时才切换</td></tr></tbody></table>

三种方式可以组合：访客按最精细的那条规则处理，例如默认规则用主备，中国规则用质量优选。主备和质量优选依赖拨测，需要先完成服务的拨测配置，见[拨测](https://www.axisnow.io/zh/docs/multi-edge/services/routing/probing.md)；规则和模式的说明见[流量调度](https://www.axisnow.io/zh/docs/multi-edge/services/routing.md)。

## 验证 <a href="#verify" id="verify"></a>

路由规则保存后，确认各地区的访客由预期的那一家边缘响应，方法见[测试与验证](https://www.axisnow.io/zh/docs/multi-edge/services/edge-providers/testing.md)。

运行一段时间后，两家的流量、调度结果和拨测质量在服务的[仪表盘](https://www.axisnow.io/zh/docs/multi-edge/services/dashboard.md)中汇总查看。

## 注意事项 <a href="#notes" id="notes"></a>

* **Cloudflare 上原有的规则不会带到第二家**：zone 上的缓存和安全规则只对走 Cloudflare 的流量生效。需要两家一致的规则，在服务的[策略](https://www.axisnow.io/zh/docs/multi-edge/services/policy.md)中配置，由 AxisNow 同步到配置同步方式加入的边缘。
* **源站放行**：源站只放行 Cloudflare 的 IP 时，需要把第二家边缘的回源 IP 一并放行。
* **随时可以退回**：删除为地区新建的规则，把默认规则改回固定并指向 Cloudflare，流量即全部回到 Cloudflare。以一键解锁接入的域名，还可以在向导中恢复记录，回到直连 Cloudflare，见[恢复与取消](https://www.axisnow.io/zh/docs/multi-edge/getting-started/unlock-cloudflare.md#restore-and-cancel)。

## 完整示例 <a href="#example" id="example"></a>

[AxisNow + Cloudflare 双 CDN 互备和优化中国访问](https://www.axisnow.io/zh/docs/guide/cloudflare-china-acceleration.md)按这个方式完成了一个具体的场景：第二家是 AxisNow 边缘，中国大陆访客走它，其余访客仍走 Cloudflare。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.axisnow.io/zh/docs/multi-edge/use-cases/cloudflare-multi-cdn.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
