Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Replit 4 min read Case study mediumAdept

HTTPS by default

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. The proxy manages roughly half a million Let's Encrypt certificates via ACME. It uses HTTP-01 validation for custom domains, which already CNAME to the proxy, and DNS-01 for per-user wildcard certificates (*.<user>.repl.co), so each user needs only one certificate. Certificates are renewed lazily on request once fewer than 30 days remain, about 5,000-10,000 per day. A conservation mode defers renewals when ACME rate-limit capacity runs low, and a circuit breaker forces renewal for certificates near expiry.

Assumes: TLS certificatesDNS recordsHTTP redirects

Related posts

  • Why We Built Our Own DNS Infrastructure

    Replit mediumAdept

    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. This avoided a "meta-proxy" layer that would have added two extra hops per request. The Go server, built on miekg/dns, CNAMEs ACME DNS-01 challenges to a GCP-managed validation zone. Because DNS caching can outlive the 60s TTL, proxies in the old cluster use tombstones to transparently forward requests for repls that have moved. Custom domains work unchanged because they already CNAME to <repl id>.repl.co.

  • How CDNs Generate Certificates

    Fly.io mediumAdept

    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.

  • Using short-lived certificates to protect TLS secrets

    Meta Engineering mediumAdept

    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). Certificates are issued months ahead from third-party CAs and moved from a locked-down secret store to an edge-only store just 10 days before expiry, which keeps CA issuance off the critical path and provides ready backup certs for emergency rotation. A ConfigBuilder groups certs into expiry-dated bundles, validates them, and rolls them out in stages: canary, then about 100 machines, then the full fleet after a day of baking. The OffloadService signs with both old and new keys during rotation, and caching plus staggered fetches keep daily rotation from overloading the secret store.

  • Welcome to the Wonderful World of Clusters

    Replit mediumAdept

    Replit split its infrastructure into multiple independent clusters (failure domains) after two load-related site-wide outages, moving paid Hacker users into their own cluster so future incidents affect only a subset of users. A cluster resolution service exposed as an external DNS server maps repls to clusters for both the web server and `.repl.co` hosting, adding no extra lookup latency. Because DNS answers are cached, users moved between clusters leave tombstones in the old cluster that transparently proxy connections to the new one until the record's TTL expires. The new cluster also became a tool for shedding load during incidents and lets Replit run Hacker repls on beefier machines.

  • That Old Certificate Expired and Started an Outage. This is What Happened Next

    Shopify Engineering mediumAdept

    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. Failures surfaced about 15 minutes late because TLS validation only happens at connection setup and HTTP keep-alive connections persisted until Kubernetes pods were recycled by a deploy. Locking monolith deployments early confined the damage to canaries, avoiding a global outage, though recommendations, marketing campaigns and order-confirmation risk checks were degraded. The fix was a fork overriding cacert.pem with automated root-bundle updates, with a longer-term move toward system trust stores under consideration.

The quest for software engineering knowledge.

Look:
Layout: