Effect Diagram#
Not optimized
After optimization
It can be seen that although the delay did not increase much after optimization, the number of exit IPs increased, which helps improve the accessibility of the website.
Requirements#
- Two primary domain names, both hosted on Cloudflare. One as the main domain and one as the auxiliary domain. Each optimization of a website on the auxiliary domain consumes one, while the main domain can be reused.
- Brain
Official Start#
- First, resolve your auxiliary domain to your website. You can use CNAME, A, or AAAA records, and you need to enable Cloudflare's CDN proxy.
- Go to SSL\TLS -> Custom Hostnames. Set the fallback origin to the domain you just configured. Set the custom hostname to the domain you ultimately want users to access (no need to set resolution at this time). The first setup requires TXT verification, simply add a TXT record at the DNS of the main domain.
- Then, add a record to your auxiliary domain pointing to the community's optimized domain, without enabling Cloudflare's CDN proxy.
- Finally, add a CNAME record on your main domain pointing to your auxiliary domain (you can use a subdomain, but it must be consistent with the previously set custom hostname).
- Access it to check if the connection is successful. You can use ITDOG to test the website.
Troubleshooting#
-
Q: If my origin site uses Cloudflare Tunnels for public access, and after following the above steps I get a
404 Not Found
error.
A: You need to add the domain you ultimately want users to access on your Tunnels page. Cloudflare will automatically create a CNAME for you; change it to point to your auxiliary domain. For example:
Cloudflare Tunnels page:
-
Q: If my origin site is not on port 80/443.
A: Set up Origin Rules, which need to include the origin site and the domain you ultimately want users to access.
-
Q: If my origin site is on serv00.
A: Create a new Proxy on the WWW Website page of serv00, with the domain as the domain you ultimately want users to access (not for actual use, just for whitelisting; otherwise, access will be unreachable).