Preface#
What is the use of accessing this? What functions can be achieved?
- Under normal circumstances, you must change the DNS resolution server of your domain name to Cloudflare in order to use their services. SaaS allows you to use Cloudflare's services without using their DNS resolution server. For example, you can use Alibaba Cloud or Huawei Cloud's DNS resolution server. This has a benefit, as Alibaba and Huawei's DNS can perform line-based resolution. You can route traffic through Cloudflare for international visitors and directly to the origin server for domestic visitors, or vice versa. It's very flexible!
- When binding a regular domain to Cloudflare, two default IPs are assigned, and these IPs cannot be changed. SaaS allows you to choose your own IP. Cloudflare optimizes IPs for domestic use.
Preparation#
- Credit card or PayPal
- 2 domain names, one primary and one backup
Explanation of Primary and Secondary Subdomains#
Primary domain: Hosted on Dnspod
Backup domain: Hosted on Cloudflare
Origin server IP: Your own server IP
Setting up the Backup Domain#
Bind the backup domain to your Cloudflare account. Open the SSL/TLS
→ SSL/TLS
→ Overview
→ Full
→ Custom Hostname
→ Enable Cloudflare SaaS
in the domain settings as shown below. Then proceed to the Credit Card/PayPal
page for verification. The verification page is omitted from the image (the first 100 domains are free, as confirmed by the author of this blog, so it's definitely not charged. Verifying the credit card may be a measure to prevent abuse)
Configure the backup domain to resolve to the origin server IP
- Type: A
- Name: You can customize it, for demonstration purposes I'll use
past
- IPv4 address: Enter your origin server's IP
- Proxy status: On
As shown below:
Go back to the SSL/TLS Custom Hostname page
Enter the backup domain that was just resolved in the fallback origin input, then click on Add Fallback Origin
on the right side, as shown below. Finally, refresh the page to make it effective
After it takes effect, click on Add Custom Hostname
at the top of the image to add our primary domain
Setting up the Primary Domain#
Add a TXT record to verify the primary domain
Here you will see the TXT record to be added. Copy it and add it in Dnspod
Wait for it to take effect, then we can choose to use CNAME
resolution for overseas visitors. The record value should be the backup domain that resolves to the server IP. This way, international visitors will automatically use Cloudflare's routing.