Clarify Requirements

Currently, I am using three CDNs: Alibaba Cloud ESA, Tencent EdgeOne, and Cloudflare. The first two are domestic companies, and after domain备案 (filing), their performance within China is excellent. However, their domestic nodes can be a bit strained when serving international users, which led to the need for website automatic traffic splitting.

NS Settings

It is recommended to host your domain's NS records with Alibaba Cloud (or another NS provider that supports traffic splitting). Cloudflare does not support this, so if your domain is with Cloudflare, you'll need to move it elsewhere.

CDN Settings

Cloudflare

Due to Cloudflare's characteristics, to use its acceleration service, you need to bind a domain to Cloudflare. However, traffic splitting cannot be done with the domain you intend to use. Therefore, it is recommended to obtain a free IPv6 reverse DNS domain as an auxiliary domain. SSL is currently banned, but this is not an issue as long as you do not enforce HTTPS access on your server.

After adding the IPv6 reverse DNS domain, go to DNS and add your service. You can name it anything, just remember it. Simultaneously, enable the "little yellow cloud" (proxy status).

image.png

This is not all. Add a DNS-only record with any name that CNAMEs to www.shopify.com (i.e., turn off the "little yellow cloud").

This step is to optimize IP selection and speed up access.

Now, go to SSL, then Custom Hostnames. image.png

It seems you need to verify a credit card or PayPal. If you cannot do this, search on Xianyu (a second-hand marketplace). Normal usage is free and includes 100 subdomains, which is usually sufficient.

Then, set a fallback origin. Enter any auxiliary domain under your name that points to your server. image.png

Next, add a custom hostname. The custom hostname is your traffic splitting domain. For certificate verification, select HTTP. If you don't mind the hassle, select TXT. For the custom origin server, enter the auxiliary domain that points to this service. For example, if you want to access my file website via file.imsuk.cn, and the domain pointing to the file website is file.0.1.1.1.9.1.0.0.0.7.4.0.1.0.0.2.ip6.arpa, then enter that. After completion, click "Add." The server does not need configuration; it uses the custom hostname for origin requests.

image.png

After configuring the service, go to your DNS provider and add a CNAME record. The value should be the domain you CNAMEd to www.shopify.com, for example, cname.0.1.1.1.9.1.0.0.0.7.4.0.1.0.0.2.ip6.arpa. For the host record, enter it normally.

image.png

Now, the Cloudflare configuration is complete.

ESA

First, go to the ESA console and add your site. Select CNAME access and verify.

ESA Consoleimage.png

After configuring the site, click on the site name to enter the settings.

image.png

Find the Managed DCV setting and copy the record value. Open your DNS settings (e.g., Alibaba Cloud DNS resolution). Add a CNAME record with the name `_acme-challenge` and the value as your root domain plus the record value. For example:

image.png

After configuration, apply for a free certificate from Let's Encrypt in the certificate management above. Enter * in the certificate domain and click the wildcard domain below, then click confirm to apply for the SSL certificate.

image.png

Once completed, you can add services normally. After adding, you will get a CNAME address similar to **.a1.initxa.com. Go to your DNS provider to add the CNAME configuration. Fill in the other fields normally, but remember to select the China region for the request source.

image.png

image.png

EdgeOne

It's the same. Go to the console, add your site, and verify the configuration. Again, remember to select CNAME access here.

image.png

After configuration, directly add the services you want to add. You will get a CNAME address similar to **.cn.eo.dnse1.com.

Then go to your DNS provider and add the CNAME record. Here, also select the China region, but set the weight to 2. This will increase the success rate of EO's SSL issuance. Personally, I think EO's speed is faster than ESA, so I recommend setting a higher weight.

image.png

After adding, return to the EO console, click HTTPS configuration, select Edge HTTPS Certificate, and then select CNAME in the free certificate application.

image.png

image.png

Click save and wait for the SSL certificate to be issued. At this point, our traffic routing configuration is complete.

Testing

You can use ItDog for testing, but DNS updates have a delay. You should see different CDN providers, with Tencent or Alibaba Cloud in China and CF abroad. DNS will automatically update after 24 hours.

image.png

Adding CDN Display to Handsome Theme

CDN Settings

Cloudflare

Enter the rules for auxiliary domains.

image.png

Click "Create Rule" and then "Transform Response Header". Give it a name. For all requests, modify the response headers to set static resources.

Set Access-Control-Allow-Methods to *, and Access-Control-Allow-Origin to *.your domain.

image.png

EdgeOne

Create a blank rule in the Rules Engine under Site Acceleration.

image.png

The matching type is HTTP request header, custom Origin equals .your domain, the operation is to modify the HTTP response header, the type is set, one name is Origin, and the other is Methods, Methods is set to , and Origin is set to ${http.request.headers["Origin"]}

image.png

image.png

Then save and publish

ESA

Find the modification response header in the rule conversion rule and add a new rule

image.png

All incoming requests, static changes. Access-Control-Allow-Origin is .your domain, Access-Control-Allow-Methods is

image.png

Click OK to save

Theme Settings

Add at the bottom left or bottom right

<div class="github-badge" id="cdn-badge">
    <span class="badge-subject">This site is hosted by</span>
    <span class="badge-value bg-green" id="cdn-provider">Loading...</span>
</div>

This is the code that introduces CSS. Search for Handsome footer badge beautification online and add the CSS code.

Add in custom JavaScript

[hide]File[/hide]

See the effect in the bottom right footer of this site

END

本文标题:网站分流怎么做?全球秒开!

本文链接:https://www.imsuk.cn/archives/146/

除非另有说明,本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议

声明:转载请注明文章来源。

Last modification:February 6, 2026
请用钱砸我