For websites that provide services in both Chinese and English, balancing access speed for domestic and international users is very important. Tencent Object Storage is a distributed storage service designed for unstructured data, supporting HTTP/HTTPS protocol access. It can store massive amounts of data and ensures users are unaware of bandwidth and capacity expansions. It can serve as a static file storage location for our website. After applying for a free COS space at https://cloud.tencent.com/product/cos, you can also get free CDN service with 50GB of free CDN traffic. You just need to add a website with proper ICP registration.
Cloudflare is the world’s largest free CDN provider, offering free HTTPS services, unlimited DDoS protection, and many other benefits. Cloudflare (CF) is perfect for international websites, but its free plan is relatively slow for domestic users in China and is sometimes called a “speed-reducing CDN.” So can we use Tencent CDN for domestic users and CF’s free CDN for international users simultaneously? The answer is yes.
Currently, there are two ways to use domestic CDN and CF simultaneously. The core of this approach is to use Alibaba Cloud’s Intelligent DNS. My DNS servers are dns3.hichina.com and dns4.hichina.com. Intelligent DNS allows matching different service addresses based on IP source, with support for different NS servers, IPs, and CNAMEs. It’s fantastic. So to use domestic and CF CDN simultaneously, you need to register the domain with Alibaba Cloud (I haven’t tried transferring a domain registered outside to Alibaba Cloud’s console).
Since domestic websites must be ICP registered, the domain must have proper registration; otherwise, the domestic CDN cannot be added. Below is a detailed explanation of how to use domestic CDN and CF CDN simultaneously to improve website speed and protect the site.
Solution 1: Domestic IP resolves to Tencent CDN via CNAME, Foreign IP uses CF NS servers
Step 1: Change NS servers to CF’s NS servers.
As shown above, in Alibaba Cloud’s console, find your domain (here it’s bobobk.com), select DNS modification, verify via phone, then modify NS to CF’s NS servers. Next, add your website in Cloudflare. CF will verify NS settings; once verified, you can configure DNS entries there. If previous entries exist, you can modify them directly in CF, and ensure the status shows orange, which means CDN is enabled; otherwise, the origin server is exposed.
Step 2: Change NS servers back to Alibaba Cloud NS servers (dns3.hichina.com, dns4.hichina.com).
The modification method is the same. The key part is to go to DNS resolution in Alibaba Cloud console for bobobk.com and set the foreign NS records to CF’s servers, and set CNAME records to Tencent CDN’s CNAME address. This way, domestic IPs access Tencent CDN, and foreign IPs access CF’s global acceleration nodes.
Check the speed after configuring domestic and foreign CDN!
As you can see, speeds are very fast domestically and internationally. This completes the first method.
Solution 2: Domestic IP resolves to Tencent CDN via CNAME, Foreign IP resolves to Cloudflare CDN via CNAME
Step 1: Become a Cloudflare partner
This method requires the ability to obtain Cloudflare CNAME records. For individuals, you need to apply as a Cloudflare partner to get this. Apply here: https://www.cloudflare.com/partners/
A quick Google or Baidu search will give many tutorials, so details won’t be covered here.
Step 2: Set different CNAME records based on IP
After obtaining CF partner CNAME, go to Intelligent DNS settings.
Set foreign CNAME to CF’s CNAME, and default to Tencent CDN’s CNAME. That’s it!
This tutorial shows how to use domestic CDN and Cloudflare CDN simultaneously for global acceleration. Currently, I am using the first method, and I am applying to become a CF partner. Later, if anyone wants to use CF CNAME resolution, I can help you set it up.