
A Guide to CDN Configuration
2 min read
This page was translated by AI
Introduction
Some time ago, Tencent Cloud’s overseas product, EdgeOne, launched the first free global CDN that supports access from China. It looks as though Tencent Cloud wants to be the internet’s benevolent benefactor in China.
After spending some time getting an invitation code for the overseas version, I immediately bound the plan to the domestic site. Invitation codes for the overseas and domestic versions of EdgeOne are interchangeable.
With a free CDN available, I put my blog behind it. I had configured a CDN before, but the number of settings was overwhelming, so I never properly finished it.
This was a good opportunity to explore it in more detail. Once I was done, seeing everything green in ITDOG was very satisfying.
Configuration Process
1. Preparation
-
Identify your requirements
- What type of traffic needs acceleration, such as a website, video, or file downloads.
- Whether you need features such as HTTPS, hotlink protection, or access control.
- Estimate bandwidth requirements, then choose a CDN provider and plan.
-
Domain registration
- If you provide services in mainland China, complete ICP filing for the domain when using a domestic CDN provider.
-
Prepare the origin server
- Make sure the origin server, such as a web server, OSS, or object storage, is accessible. Record its domain name or IP address.
2. Bind a Domain and Configure Its CDN Origin
Configuration steps:
-
Create an origin domain:
- Create a domain, for example
origin.example.com, and point it to the origin IP. - Configure an SSL certificate. HTTPS is recommended, and HTTP access should be disabled.
- Create a domain, for example
-
Configure CDN acceleration:
-
Bind the domain you want to accelerate to the CDN provider.
-
Enter the origin domain in the CDN settings:
Origin address: http://origin.example.com
Origin Host header: origin.example.com
-
-
HTTPS settings:
- Configure SSL certificates separately for the CDN domain and origin connection.
- HTTP 2.0
- Enabling a forced redirect is recommended. In most cases, the backend server should also redirect requests or disable HTTP access entirely, allowing HTTPS only. Use HTTP-to-HTTPS with a 302 response and no headers.
- HSTS: leave disabled by default.
- TLS: keep the default setting.
- OCSP: enable it.
3. Caching
CDN services generally cache content at multiple nodes so users can retrieve it from a nearby location with lower latency.
This lets us cache persistent files on edge servers, reducing load on the origin server and improving access speed.
I will not provide specific settings here, because different websites need to cache very different content. You can use the templates provided by Tencent Cloud or configure your own.