Due to the website's server being located domestically, accessing it from abroad is very slow. Separating the parsing requests for domestic and international access, with domestic traffic using domestic lines and international traffic using Cloudflare, can effectively improve the speed of access from abroad.
The following items need to be prepared#
A Cloudflare account, a PayPal account linked to a bank card (used to activate the free Cloudflare for SaaS, so the bank card can have no balance), and a little time.
Register a domain name for relay#
First, go to EU.org to register a free second-level domain:
Once there, please ignore the website's minimalist design, click Sign-in or sign-up here! -> Register to create an account. The required fields are: Name, E-mail, Address (line 1), Address (line 2), Country, Password, Confirm Password. After filling in, check the option that I have read and accept the domain policy to complete the account registration.
Important
It should be noted that the Name field seems to require a space and cannot contain numbers; for example, entering Vinking
will result in an Enter a valid value. error, while entering Vinking loma
will pass validation. Additionally, Address (line 1) and Address (line 2) can be filled in arbitrarily, but cannot be left blank.
Next, you will receive a verification email:
Click the link nic.eu.org/arf/XXX to verify your email. After completing this, copy the XXX-FREE
that follows nic-hdl in the email and paste it into the Handle text box on the login page; the password is the one you just set.
After logging in, click New Domain to register a domain name, first filling in Complete domain name (the domain name you want to register; you can click the list below to see available domain suffixes). Here, we will take the application for the free domain vinkingtest.eu.org
as an example for the following introduction.
Next, we need to go to Cloudflare to add a site (at this point, the domain name has not yet been fully registered, so please do not close the domain registration page).
Click to add a site -> fill in the domain name you just applied for (for example, here it is vinkingtest.eu.org
) -> choose the free plan -> skip adding DNS records, and finally, you will get two Cloudflare name servers kenneth.ns.cloudflare.com
and malavika.ns.cloudflare.com
.
Return to the domain application page and fill them into Name1 and Name2 at the bottom of the Name servers section, then click Submit. If you see No error, applying changes... Done, it means the domain registration has been completed. For Cloudflare, click Finish, Check Name Servers to complete the domain access.
Wait#
EU.org takes some time to complete domain registration, ranging from a few minutes to a week. Personally, I waited about two to three hours to receive the email confirming successful domain registration, and Cloudflare will also send an email confirming the successful activation of the domain, at which point you can proceed to the next step.
Parse Subdomain#
First, enter the free domain you just applied for in Cloudflare, click DNS, and add a subdomain resolution; this subdomain will be used as a relay domain. You can refer to the settings below for specific entries, using i
as the name example:
SaaS Access#
Next, in the SSL/TLS Custom Hostname, Enable Cloudflare for SaaS, you will need to link a PayPal bank card for subscription. Cloudflare for SaaS offers one hundred custom hostnames for free, which is sufficient for individual users; for any additional ones, the price is $0.1 each per month.
Note
If you need to cancel the subscription, click the profile icon in the upper right corner -> Billing -> Subscription -> Cancel.
After enabling SaaS, add a Fallback Origin. The fallback origin is the subdomain you just parsed, so here my fallback origin is i.vinkingtest.eu.org
. After adding, if there are no issues, the fallback origin status will show as valid.
Next, click Add Custom Hostname, and the custom hostname is your website name; here we will use vinking.top
as an example. Additionally, if your website does not need to support outdated browsers like IE6, it is recommended to set the Minimum TLS version to TLS 1.1 or higher for improved security; you can refer to the following settings for filling in:
After completing the settings for adding a custom hostname, you will receive two records: Certificate Validation and Hostname Pre-validation. Next, you need to add two corresponding resolutions at your domain service provider (such as Tencent Cloud, Alibaba Cloud, etc.).
Domain Service Provider Access#
When the Certificate Validation and Hostname Pre-validation records are verified in Cloudflare (both certificate status and hostname status show as valid), we also need to add a CNAME record at the domain service provider with the request source as overseas and the record value as Fallback Origin (here it is i.vinkingtest.eu.org
). At this point, our domain DNS resolution will have two CNAME records to handle different request sources.
If we access the website using a foreign IP, seeing the following page indicates that the resolution was successful.
This article is synchronized and updated by Mix Space to xLog. The original link is https://www.vinking.top/posts/codes/improve-website-speed-with-cloudflare-dns