ARTICLE - CDN Acceleration

Tencent Cloud CDN Guide: Domain & Cache Rules

From adding an acceleration domain and configuring CNAME and origin rules to setting cache rules and security, this guide covers Tencent Cloud CDN onboarding and configuration.

2026-08-06 Tencent Cloud Documentation

Tencent Cloud CDN Guide: Domain & Cache Rules

What Is Tencent Cloud CDN

Tencent Cloud CDN is a content delivery network made of high-performance acceleration nodes worldwide. Business content is stored at nearby nodes per cache policy, and requests are scheduled to the nearest node for fast response, reducing latency and improving availability. It solves three common problems: long physical distance between users and servers, cross-carrier forwarding, and origin bandwidth/load pressure. Serving mainland Chinese users is its core scenario; see also China website overseas CDN acceleration.

How It Works

Assume the acceleration domain is www.test.com:

  1. A user requests a resource under www.test.com; the request goes to the local DNS first.
  2. The local DNS finds the CNAME www.test.com.cdn.dnsv1.com and hands the query to the Tencent GSLB scheduling system.
  3. GSLB returns the best node IP based on user location, carrier, and node health.
  4. The user reaches that node: on a cache hit it returns directly; on a cache miss it fetches from the origin, caches per policy, and returns.

Step 1: Add an Acceleration Domain

  1. In the Tencent Cloud console, go to CDN → Domain Management → Add Domain.
  2. Enter the acceleration domain (ICP-registered), the business type (static acceleration, download, streaming, and so on), and the origin (origin IP, domain, or COS bucket), with origin protocol and port.
  3. The system returns a CNAME address.

Step 2: Configure the CNAME

At your DNS provider, add a CNAME record pointing the acceleration domain to the returned CNAME (such as xxx.cdn.dnsv1.com). Once propagation completes, acceleration begins. After that you can monitor node status and hit ratio in the console.

Step 3: Configure Cache Rules

Under Cache Config, set rules as needed:

  • Cache expiration: set TTL by file type, directory, or full path; cache static assets long and set dynamic APIs to no-cache — see CDN cache strategy.
  • Cache key and parameter filtering: whether to ignore query parameters directly affects hit ratio.
  • Origin rules: set origin HOST, protocol, and timeout to protect origin bandwidth and stability.

Suggested TTLs by resource type (adjust to your business):

Resource type Example Suggested TTL
Images/fonts /images/*, *.woff2 30+ days
CSS/JS /static/css/* 7-30 days (with versioned names)
HTML pages /, /about.html 10 min - 1 hour
Dynamic APIs /api/* No cache or 0 seconds
Temporary files /tmp/* No cache

Rules match from longest to shortest and specific to general. After configuring, verify in the purge/preheat area: preheat one URL, then compare origin logs to see whether it hit, and iterate a couple of times to stabilize the rules. For cache-key details see cache key strategy.

Step 4: Purge and Preheat

After origin updates, submit requests under purge & preheat:

  • Purge URLs/directories: clear specific cache, for releases and corrections.
  • Preheat URLs: push popular resources to nodes in advance, ideal before promotions and version releases.
  • Again, use versioned URLs to reduce purge frequency and quota usage.

Step 5: Configure HTTPS and Security

  • HTTPS config: enable and configure a certificate (free certificate or custom upload); force HTTPS for security — see SSL certificate guide 2026.
  • Security: anti-leech, IP allow/deny lists, and URL authentication; advanced protection can combine WAF/EdgeOne — see CDN security protection features.

Pricing and When to Choose It

Tencent Cloud CDN offers pay-by-traffic and pay-by-bandwidth, plus overage packages and resource packs — details in CDN cost optimization guide. It suits mainland-focused, static-heavy websites, app updates, game packages, and audio/video delivery. For hybrid dynamic/static acceleration, pair it with Tencent Cloud EdgeOne 3.0; see dynamic content acceleration DCDN.

Billing Example and Common Issues

With pay-by-traffic, suppose monthly egress is 200 GB at roughly ¥0.2/GB — about ¥40/month in CDN cost. If peak bandwidth holds steady at 30 Mbps, pay-by-bandwidth may be cheaper. The real question is not unit price but how even your traffic is: choose traffic billing for spiky traffic, bandwidth billing for sustained full load. Sites with many domains and high request volume should also watch request-based charges, which climb noticeably during sales events — see the cost checklist in the CDN cost optimization guide.

When troubleshooting, these causes are the most common:

  • CNAME not resolving: usually a DNS cache or a typo; use dig to confirm the returned CNAME matches the Tencent console.
  • Low hit ratio: check whether dynamic APIs were mistakenly made cacheable, or query parameters are exploding the cache key — see the cache key strategy and hit-ratio optimization.
  • Origin timeout: insufficient origin bandwidth or a mismatched origin protocol; load-test the origin first, then raise the origin timeout.
  • Anti-leech false positives: after enabling Referer anti-leech, some legitimate referrers get blocked — keep the allow list complete.

16IDC Take

Tencent Cloud CDN's strengths are synergy with the Tencent ecosystem (COS, EdgeOne, WeChat/mini-program scenarios) and mainland scheduling quality. For domestic sites it stands alongside Alibaba Cloud as a "hassle-free pick" — see the Alibaba Cloud CDN setup guide for a side-by-side comparison. If you also serve overseas users, evaluate overseas coverage or stack multiple CDNs. For overall selection see CDN provider selection guide. More content in the CDN acceleration category.

Reference: Tencent Cloud CDN documentation https://cloud.tencent.com/document/product/228; source https://cloud.tencent.com/document/product/228/2939

Integration & Code Examples

Example 1: Inspect domains and purge cache with tccli

# Credentials come from environment variables (TENCENTCLOUD_SECRET_ID / SECRET_KEY),
# or from tccli configure; never hardcode them in scripts
pip install tccli

# 1) List the accelerated domains on the account
tccli cdn DescribeDomains --offset 0 --limit 20

# 2) Inspect one domain's configuration and CNAME target
tccli cdn DescribeDomainsConfig \
  --Filters '[{"Name":"domain","Values":["cdn.example.com"]}]'

# 3) Purge URLs and directories; mind the difference in FlushType semantics
tccli cdn PurgeUrlsCache --Urls '["https://cdn.example.com/app.js"]'
tccli cdn PurgePathCache \
  --Paths '["https://cdn.example.com/static/"]' --FlushType flush

# 4) Poll task status; a successful call is not global propagation
tccli cdn DescribePurgeTasks --StartTime "$(date -u +%Y-%m-%dT%H:%M:%SZ)"

Sub-commands and parameter names follow the Tencent Cloud API documentation; put purges in the release pipeline and poll task status before announcing completion.

Example 2: Read and verify cache settings through the SDK

from tencentcloud.common import credential
from tencentcloud.cdn.v20180606 import cdn_client, models

# Credentials are read from environment variables, never persisted
cred = credential.EnvironmentVariableCredential()
client = cdn_client.CdnClient(cred, "ap-guangzhou")

req = models.DescribeDomainsConfigRequest()
req.Filters = [{"Name": "domain", "Values": ["cdn.example.com"]}]

resp = client.DescribeDomainsConfig(req)
for d in resp.Domains:
    # Print current state first: domain, CNAME, status, then decide what to change
    print(d.Domain, d.Cname, d.Status)

# Configuration writes are high-risk: export a snapshot and validate on a test domain
# Field names and mutable options follow the official API documentation

Read paths (Describe*) are safe to automate; write paths (Update*) deserve human review so one script run cannot rewrite every domain.

Three Levels of Cache Rule Matching and Verification

Cache rules are written at three levels — exact path, file type and directory — and matching runs from precise to broad. Invert the order and a wide rule swallows a narrow one.

Match type Example Coverage Verification
Exact path /static/css/app.css A single file Purge that URL, then compare against origin logs
File type *.woff2, /images/* One extension or its directory Preload one such URL and check for a hit
Directory /static/ The directory and its subpaths Purge the directory, then recheck hit ratio
API path /api/* Dynamic requests, uncached or TTL 0 Confirm all of them go back to origin

Verify in the refresh and preload panel: preload one URL, compare the origin log to confirm a hit, and repeat two or three times until the rules settle.

Wider rules raise the hit ratio but make purges more expensive; narrower rules give precise control while the rule count grows quickly.

Versioned URLs for static assets cut the purge frequency and push those files into the long-TTL tier.

Origin Settings and Origin Types

An origin can be an IP, a domain or a COS bucket. A self-hosted server with a fixed address takes an IP, a service whose address changes takes a domain, and static assets can point straight at a bucket.

Three settings go together on the origin side: Host, protocol and timeout. Host decides which site the origin answers for, the protocol must match what the origin actually serves, and a mismatch shows up directly as failed fetches.

Look at origin bandwidth before widening the timeout. With insufficient bandwidth, a longer timeout only postpones the failure while the slow origin stays the root cause.

Hotlink protection and IP allow/deny lists act on the CDN side, so an incomplete allowlist blocks legitimate referrers too; after configuring them, check each expected source one by one.

Limitations

  • Read paths (Describe*) are safe to automate; write paths (Update*) deserve human review so one script run cannot rewrite every domain.
  • This article reflects public information as of 2026-08-06; terms, prices and quotas follow the provider's current published terms.
  • Third-party capability and limit statements follow their official documentation; no further commitment is implied here.
  • Licensing, filing and data-residency decisions must be verified against the regulations of your operating region.

FAQ

Is traffic billing or bandwidth billing cheaper here?

It depends on how even the traffic is. At 200GB of monthly egress and roughly ¥0.2/GB, traffic billing lands near ¥40; if peak bandwidth holds at 30 Mbps, bandwidth billing may win. Spiky traffic suits traffic billing, sustained load suits bandwidth billing, and request charges climb during sales.

What is required before adding an acceleration domain?

An ICP-registered domain, first. In the console you then enter the acceleration domain, the business type (static, download or streaming) and the origin — IP, domain or COS bucket — plus origin protocol and port. The console returns a CNAME such as xxx.cdn.dnsv1.com for your DNS provider, and propagation is not instant, so verify with dig.

How should tccli credentials be stored?

Inject API credentials as environment variables, never in files. Use TENCENTCLOUD_SECRET_ID and SECRET_KEY, or tccli configure for local config, and keep plaintext out of scripts. Read calls (Describe*) are safe to automate; write calls (Update*) deserve human review so one run cannot rewrite every domain, and export a config snapshot first.

Related Providers

  • Tencent Cloud EdgeOne: when DDoS scrubbing and layer-4 acceleration must sit on the same edge layer as static CDN.
  • Aliyun CDN: when another mainland CDN's cache rules and billing tiers are needed as a side-by-side reference.

Community & Resources

Official docs and communities

Learning resources and tools

Original source: Tencent Cloud Documentation ↗