---
title: "How CDNs Generate Certificates"
description: "CDNs like Fly obtain Let's Encrypt certificates for customer domains using the ACME tls-alpn-01 challenge, which needs neither DNS access nor port 80."
url: "https://swe.quest/articles/how-cdns-generate-certificates-05707ebaaeaf2273"
canonical: "https://fly.io/blog/how-cdns-generate-certificates/"
source: "Fly.io"
published: "2020-06-25"
difficulty: "medium"
kind: "Deep dive"
reading_minutes: 10
tags: ["cryptography","cdn-edge","networking","security"]
---

# How CDNs Generate Certificates

A post on [Fly.io](https://swe.quest/sources/flyio.md), published 2020-06-25, 10 min read, Deep dive. Original: [https://fly.io/blog/how-cdns-generate-certificates/](https://fly.io/blog/how-cdns-generate-certificates/)

## Summary

CDNs like Fly obtain Let's Encrypt certificates for customer domains using the ACME tls-alpn-01 challenge, which needs neither DNS access nor port 80. The older tls-sni-01 challenge was removed because shared-hosting providers let customers claim arbitrary .invalid names and upload certificates, enabling issuance for other tenants on the same IP. The history runs through NPN vs. ALPN negotiation, NPN downgrade attacks and the middlebox bug that produced the ClientHello padding extension. Fly's flow ends with its Rust proxy recognizing the "acme-tls/1" ALPN value and serving a self-signed challenge certificate. Subdomain takeover is mitigated by giving every app a unique IPv6 address and requiring a CNAME to it before validation.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Cryptography](https://swe.quest/tags/cryptography.md) (Security)
- [CDN & edge](https://swe.quest/tags/cdn-edge.md) (Infrastructure)
- [Networking](https://swe.quest/tags/networking.md) (Infrastructure)
- [Security](https://swe.quest/tags/security.md) (Security)

## Prerequisites

- TLS handshake basics ([easy posts on Cryptography](https://swe.quest/tags/cryptography.md?difficulty=easy))
- DNS records ([easy posts on DNS](https://swe.quest/tags/dns.md?difficulty=easy))
- HTTPS certificates

## Keywords

ACME, Let's Encrypt, tls-alpn-01, tls-sni-01, ALPN, NPN, TLS SNI, Fly.io

## Related posts

- [HTTPS by default](https://swe.quest/articles/https-by-default-5a72c4dccd95a788.md): Replit · 2021-02-26 · Medium · 4 min read · Cryptography, Networking, DNS, Load balancing
  Replit's proxy now redirects all HTTP requests to server repls to HTTPS and serves HSTS headers, so every hosted server is HTTPS by default.
- [Using short-lived certificates to protect TLS secrets](https://swe.quest/articles/using-short-lived-certificates-to-protect-tls-secrets-b95eb80ecde3a8e1.md): Meta Engineering · 2023-08-07 · Medium · 7 min read · Cryptography, Security, CDN & edge, Deployment
  Meta now limits TLS private key exposure on its edge to 10 days by rotating short-lived certificates daily, after rejecting CRL/OCSP revocation (latency, failure modes), remote signing from datacenters (vulnerable to backbone and datacenter outages) and delegated credentials (insufficient browser support).
- [Why We Built Our Own DNS Infrastructure](https://swe.quest/articles/why-we-built-our-own-dns-infrastructure-b1c8975cd0ea6aa3.md): Replit · 2021-04-29 · Medium · 4 min read · DNS, Load balancing, Distributed systems, Go
  Replit made its repl hosting cluster-aware by running its own authoritative DNS server for \*.repl.co, which resolves each repl's domain to the proxy load balancer in the cluster hosting that repl.
- [4 real? Tracking exploitation and patching of eMudhra’s weak keys](https://swe.quest/articles/4-real-tracking-exploitation-and-patching-of-emudhra-s-weak-keys-28b2359b601d1af4.md): Cloudflare · 2026-10-30 · Medium · 7 min read · Cryptography, Incidents & postmortems, Security, Observability
  eMudhra's eight intermediate CA keys were trivially weak (private values like 4, 56 and 66), so anyone could recover the signing keys from the public certificates and forge certificates for any domain that unpatched clients not enforcing Certificate Transparency would accept.
- [That Old Certificate Expired and Started an Outage. This is What Happened Next](https://swe.quest/articles/that-old-certificate-expired-and-started-an-outage-this-is-what-happened-next-8e9755960d247908.md): Shopify Engineering · 2022-01-12 · Medium · 6 min read · Incidents & postmortems, Cryptography, Ruby, Supply chain security, Deployment
  When Let's Encrypt's old root certificate expired on September 30, 2021, Shopify's internal service-to-service HTTPS calls began failing because the Ruby httpclient gem, pulled in transitively by rack-oauth2, openid\_connect and google-api-client, ships its own six-year-old cacert.pem that trusted neither the expired root nor the new one.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
