> 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/preferred-domain.md). Agents can also search and read this documentation through its [MCP server](https://www.axisnow.io/zh/docs/~gitbook/mcp).

# 使用 Cloudflare 优选域名加速中国访问

一键解锁 Cloudflare 后加入优选域名两步改善中国大陆访问

站点已经接入在 Cloudflare 上，中国大陆访客打开慢或不稳定。两步即可改善：先[一键解锁 Cloudflare](https://www.axisnow.io/zh/docs/multi-edge/getting-started/unlock-cloudflare.md)，让域名可以被调度；再把一个 Cloudflare 优选域名加入服务，中国大陆访客解析到它，其余访客不变。全程不离开 Cloudflare，zone 上的配置和源站都不用改。

<figure><img src="https://3062891322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKDgGNU6JXG7cqYCk2aCz%2Fuploads%2Fgit-blob-43ebf0d4db1418e28001d246b21126ec15a78d0d%2Fcloudflare-preferred-domain-overview.png?alt=media" alt="域名指向聚合边缘的服务 CNAME：海外访客按默认规则解析到 Cloudflare，中国大陆访客按中国规则解析到 Cloudflare 优选域名，两条线路回源到同一个源站"><figcaption></figcaption></figure>

{% hint style="info" %}
下文以演示域名 `demo.axisnow.dev` 为例，它所在的 zone 是 `axisnow.dev`；优选域名以社区维护的 `saas.sin.fan` 为例。
{% endhint %}

## 和社区的 Cloudflare SaaS 教程有什么不同 <a href="#vs-community-tutorials" id="vs-community-tutorials"></a>

社区教程的思路相同：借助 Cloudflare for SaaS 让域名可以被 CNAME 指向，再按访客所在的地区解析到 Cloudflare 的默认地址或优选地址。区别在于这些步骤由谁完成：

<table data-search="false"><thead><tr><th width="150"></th><th>社区教程（手动）</th><th>AxisNow 聚合边缘</th></tr></thead><tbody><tr><td>域名和 DNS</td><td>通常需要第二个域名，并把业务域名的解析放到支持分线路的 DNS 服务商</td><td>只用业务域名所在的 zone，DNS 仍在 Cloudflare</td></tr><tr><td>Cloudflare 配置</td><td>手动创建 Fallback Origin 和 Custom Hostname，添加验证记录</td><td>向导自动完成，切换前先检测源站</td></tr><tr><td>分地区解析</td><td>在 DNS 服务商逐条配置线路</td><td>一条中国规则</td></tr><tr><td>优选地址失效</td><td>自己发现，手动改解析</td><td>拨测发现后自动切回 Cloudflare</td></tr><tr><td>退回</td><td>逐项改回</td><td>一键恢复记录</td></tr></tbody></table>

## 开始之前 <a href="#before-you-begin" id="before-you-begin"></a>

* **一个聚合边缘租户**：[免费创建](https://dashboard.axisnow.io/multi-edge-signup)。
* **一个在 Cloudflare 上代理的子域名**：记录为 Proxied，所在 zone 已启用 Cloudflare for SaaS，其余条件见一键解锁的[开始之前](https://www.axisnow.io/zh/docs/multi-edge/getting-started/unlock-cloudflare.md#before-you-begin)。
* **一个优选域名**：解析到 Cloudflare 上中国大陆访问质量较好的地址，由社区维护。

{% hint style="warning" %}
优选域名由社区第三方维护，不是 Cloudflare 官方提供的接入方式，可用性没有保证，也可能违反 Cloudflare 的服务条款。正式业务建议用另一家 CDN 承载中国大陆流量，见 [Cloudflare CDN 优化中国访问](https://www.axisnow.io/zh/docs/guide/cloudflare-china-acceleration.md)。
{% endhint %}

## 步骤 1：一键解锁 Cloudflare <a href="#step-unlock" id="step-unlock"></a>

登录聚合边缘，在 **快速入门** 中填写域名并选择 Cloudflare 集成。检测通过后点击 **开始设置**，向导在 zone 内为域名准备接入地址，各项检测和准备任务的说明见[一键解锁 Cloudflare CNAME 接入](https://www.axisnow.io/zh/docs/multi-edge/getting-started/unlock-cloudflare.md)。

<figure><img src="https://3062891322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKDgGNU6JXG7cqYCk2aCz%2Fuploads%2Fgit-blob-509c6cb08f91ca7e554de811799073bad6c752b3%2Fcloudflare-preferred-domain-01.png?alt=media" alt="一键解锁 Cloudflare 的检测结果：demo.axisnow.dev 为 Proxied 记录，可以一键解锁"><figcaption></figcaption></figure>

准备完成后点击 **切换**。域名的 DNS 记录改为一条 CNAME，指向聚合边缘的服务 CNAME，示例中为 `d617c359.01e85e.axisnow-edge.io`。此时访客仍然全部由 Cloudflare 服务，站点表现不变。

<figure><img src="https://3062891322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKDgGNU6JXG7cqYCk2aCz%2Fuploads%2Fgit-blob-992b31de2f2506569623169b9a589cf2a6ea344f%2Fcloudflare-preferred-domain-02.png?alt=media" alt="一键解锁完成：demo.axisnow.dev 经服务 CNAME 解析到 Cloudflare，可以添加第二个边缘"><figcaption></figcaption></figure>

## 步骤 2：加入优选域名 <a href="#step-preferred-domain" id="step-preferred-domain"></a>

### 2.1 添加优选域名 <a href="#step-add-preferred-domain" id="step-add-preferred-domain"></a>

点击 **添加第二个边缘**，进入服务的 **边缘提供商** 标签页。点击 **添加边缘提供商**，选择 **仅调度已有的边缘（Steer）**，在 **CNAME** 中填写优选域名，见[仅调度](https://www.axisnow.io/zh/docs/multi-edge/services/edge-providers/steer.md#add)。

<figure><img src="https://3062891322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKDgGNU6JXG7cqYCk2aCz%2Fuploads%2Fgit-blob-aace61fe0bf5805a5f7c47a6be897ddfefb1b5f9%2Fcloudflare-preferred-domain-03.png?alt=media" alt="服务的边缘提供商列表：一键解锁接入的 Cloudflare 和以仅调度方式加入的优选域名 saas.sin.fan"><figcaption></figcaption></figure>

列表中现在有两家 Cloudflare：

* **一键解锁接入的 Cloudflare**：CNAME 是 zone 内 `cfsaas-` 开头的接入地址，示例中为 `cfsaas-73885275.axisnow.dev`。
* **优选域名**：带仅调度标记，CNAME 是 `saas.sin.fan`。它还没有被路由规则引用，暂不承载流量。

### 2.2 新建中国规则 <a href="#step-china-rule" id="step-china-rule"></a>

在服务的 **流量调度** 标签页点击 **添加规则**：

* **地域**：选择中国。
* **模式**：选择质量优选。
* **边缘提供商**：优选域名和 Cloudflare 都加入。
* **拨测**：拨测 URL 使用一个可缓存的小文件，拨测组使用控制台推荐的中国拨测组，见[拨测的最佳实践](https://www.axisnow.io/zh/docs/multi-edge/services/routing/probing.md#probing-best-practices)。

默认规则保持固定模式并指向 Cloudflare，不用修改。

<figure><img src="https://3062891322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKDgGNU6JXG7cqYCk2aCz%2Fuploads%2Fgit-blob-0b79ac675bc94f52b01577c6f12915deb943a2dd%2Fcloudflare-preferred-domain-04.png?alt=media" alt="流量调度标签页：默认规则固定指向 Cloudflare，中国规则在优选域名和 Cloudflare 之间质量优选，由评分更高的优选域名生效"><figcaption></figcaption></figure>

保存后，中国大陆访客解析到两者中评分更高的一个。如图，中国规则由优选域名生效；它不可用或评分落后时，访客自动切回 Cloudflare 的默认地址。规则和评分的说明见[流量调度](https://www.axisnow.io/zh/docs/multi-edge/services/routing.md)。

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

* **流量调度** 表格的 **调度目标** 列：中国规则由优选域名生效，默认规则由 Cloudflare 生效。
* 在中国大陆的网络下执行 `dig demo.axisnow.dev`：域名经服务 CNAME 指向优选域名；在海外执行，指向 `cfsaas-` 开头的接入地址。

## 回退 <a href="#rollback" id="rollback"></a>

按影响范围从小到大：

* **中国大陆访客回到 Cloudflare 默认地址**：删除中国规则。
* **移除优选域名**：在 **边缘提供商** 标签页移除，见[移除边缘提供商](https://www.axisnow.io/zh/docs/multi-edge/services/edge-providers.md#remove-edge-provider)。
* **回到直连 Cloudflare**：在一键解锁中恢复记录，见[恢复与取消](https://www.axisnow.io/zh/docs/multi-edge/getting-started/unlock-cloudflare.md#restore-and-cancel)。


---

# 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/preferred-domain.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.
