Skip to main content

CDN Setup

CDN Setup Interface

Configure content delivery network for global asset distribution.

Prerequisites

  • Registered domain name (e.g., example.com)
  • DNS provider access for CNAME records
  • Origin server (backend, storage bucket, or load balancer)
  • (Optional) SSL/TLS certificate for custom hostname

Step 1: Create CDN Resource

  1. Navigate to CDN > Create Resource
  2. Configure:
SettingDescription
Namee.g., main-cdn or media-delivery
Origin AddressWhere CDN pulls content (e.g., origin.example.com)
Origin ProtocolHTTPS (recommended) or HTTP
  1. Save to initiate edge deployment

Propagation takes a few minutes globally.


Step 2: Configure Origin Settings

SettingDescription
Host HeaderMatch origin's expected hostname
Origin GroupAdd backup origins for redundancy

The system automatically fails over to backup origins if primary is unavailable.


Step 3: Enable HTTPS

Two options:

OptionDescription
Upload CertificateProvide cert and private key for custom hostname
Generate Free CertIssue ACME certificate from dashboard

Once validated, all CDN traffic uses HTTPS.


Step 4: Add Custom Hostname

  1. Go to Custom Domains in CDN resource
  2. Add hostname (e.g., cdn.example.com)
  3. Note the Edge Hostname (e.g., abcd1234.edge.net)

Step 5: Update DNS

Create CNAME record:

TypeNameValueTTL
CNAMEcdn.example.com<edge-hostname>300

Wait for DNS propagation (usually minutes).


Step 6: Configure Caching

  1. Open Caching tab
  2. Configure:
SettingRecommendation
Cache keyPath + query parameters
CompressionEnable gzip/brotli
Large filesEnable range requests

Override cache headers with custom rules as needed.


Step 7: Test CDN

curl -I https://cdn.example.com/index.html

Expected response:

  • Status 200 OK
  • X-Cache: HIT header (after first request)
  • Valid HTTPS certificate

Step 8: Cache Management

ActionDescription
Purge CacheRemove outdated files from edge nodes
Prefetch ContentPre-load high-demand assets

Monitoring

Review CDN metrics regularly:

  • Traffic volume
  • Cache hit ratio
  • Response time

Adjust cache rules and TTLs based on traffic patterns.


Troubleshooting

IssueCauseSolution
404 from CDNOrigin path mismatchVerify origin path and headers
SSL ErrorCertificate not appliedRe-upload or re-issue certificate
Cache not updatingStale objectsPurge affected URLs
Propagation delayDNS TTL or edge syncWait and retry