CDN SSL/TLS: Encryption from Edge to Origin

· James Thornton · 4 min read

Two TLS Connections

With a CDN, HTTPS traffic involves two separate TLS connections: For foundational context, read CDN DDoS Protection: How CDNs Absorb Volumetric Attacks — FlyFish NWA.

  1. Client → CDN Edge: Uses your domain's certificate. The CDN terminates TLS at the edge.
  2. CDN Edge → Origin: A separate TLS connection from the CDN to your server.

These can use different certificates, protocols, and cipher suites.

CDN Protocol Stack — Layered network architectureCDN Protocol Stack — Layered network architecture CDN Protocol Stack Application Layer HTTP/2, HTTP/3, WebSocket Layer 5 Security Layer TLS 1.3 / Certificate Pinning Layer 4 Transport Layer TCP (HTTP/2) or QUIC (HTTP/3) Layer 3 Network Layer IP / Anycast Routing Layer 2 Physical Layer Fiber / Peering / IXP Layer 1 Higher ← Abstraction → Lower
Figure 1: CDN Protocol Stack — Layered network architecture

Certificate Types

CDN-Managed Certificates

Most CDNs provision certificates automatically:

Performance Comparison: Edge vs Origin Processing
Metric Edge Processing Origin Processing Improvement
Latency (p50)8–15 ms120–300 ms15–20x faster
Cache Hit Ratio85–95%N/AReduces origin load
TLS Handshake1–5 ms (nearby PoP)50–150 ms10–30x faster
Bandwidth Cost$0.01–0.04/GB$0.05–0.12/GB3–5x cheaper
Availability99.99% (multi-PoP)99.9% (single DC)10x fewer outages

Custom Certificates

Upload your own certificate to the CDN. Required for: EV certificates (green bar), certificates from specific CAs, wildcard certificates you already own.

Encryption Modes

ModeClient→EdgeEdge→OriginSecurity Level
OffHTTPHTTPNone
FlexibleHTTPSHTTPPartial (origin unencrypted)
FullHTTPSHTTPS (any cert)Good (origin may use self-signed)
Full (Strict)HTTPSHTTPS (valid cert)Best (origin cert validated)

Always use Full (Strict). Flexible mode leaves your origin traffic unencrypted — a man-in-the-middle between CDN and origin can intercept everything.

TLS Protocol Versions

Configure the minimum TLS version your CDN accepts:

Protocol Handshake Flow — Connection establishment sequenceProtocol Handshake Flow — Connection establishment sequence CDN Request Flow — From Browser to Edge CDN Request Lifecycle Step 1 DNS Lookup Step 2 TCP Connect Step 3 TLS Handshake Step 4 Edge Server Step 5 Cache Check Step 6 Response Cache HIT → 5ms response Cache MISS → Fetch origin 0ms ~50ms (cache hit) ~200ms (cache miss)
Figure 2: Protocol Handshake Flow — Connection establishment sequence

Recommended: minimum TLS 1.2, with TLS 1.3 preferred.

Cipher Suites

Cipher configuration balances security and compatibility:

# Strong TLS 1.3 ciphers (automatic, not configurable)
TLS_AES_256_GCM_SHA384
TLS_CHACHA20_POLY1305_SHA256
TLS_AES_128_GCM_SHA256

# Recommended TLS 1.2 ciphers
ECDHE-ECDSA-AES256-GCM-SHA384
ECDHE-RSA-AES256-GCM-SHA384
ECDHE-ECDSA-CHACHA20-POLY1305

Key requirements: Forward secrecy (ECDHE), authenticated encryption (GCM or POLY1305), no CBC mode, no RC4, no 3DES.

Origin Certificates

For the CDN→origin connection, you have several options:

HSTS and Security Headers

Configure the CDN to send security headers including HSTS:

Strict-Transport-Security: max-age=31536000; includeSubDomains; preload

HSTS forces browsers to use HTTPS for all future connections. The preload directive submits your domain to browser preload lists, ensuring HTTPS from the very first visit.

Certificate Monitoring

Monitor certificate expiration across both edge and origin. Certificate transparency logs track all certificates issued for your domain. Set alerts for: certificates expiring within 30 days, new unauthorized certificates issued for your domain, TLS handshake errors increasing.

External References

References & Standards: HTTP/2 specification · W3C Web Performance