SaaS & Custom Domains
How to design TLS for SaaS custom domains at scale
A customer hostname is not a marketing field. It is ownership, DNS, issuance, delivery and renewal.
The current problem
A SaaS product invites a customer to “use your own domain.” The UI is a text box. The backend is a five-stage lifecycle that most products only discover when the first renewal fails:
- The customer types a hostname they claim to own.
- You prove that claim (or you issue a certificate for a name you cannot later re-validate).
- You obtain a publicly trusted leaf that includes that name.
- You deliver the leaf to the process that already answers TLS for that SNI.
- You do it again before
notAfter, without another marketing page.
From 15 March 2026 a new public subscriber certificate lasts at most 200 days. From 15 March 2027, 100 days. From 15 March 2029, 47 days. Domain-control-validation reuse shrinks on the same dates, and to 10 days in 2029. Let’s Encrypt’s default path is independently moving toward 45 days. Custom-domain TLS that was “issue once at onboarding” is now a standing feature of the product, with a failure mode that shows up as the customer’s brand being offline.
The hostname is not a vanity string. It is an identifier in the Web PKI, a DNS delegation, a row in your tenant table, a certificate, a listener, and a renewal job. If any of those disagree, HTTPS is down and your status page is still green.
Why it matters
Customers type custom domains because they do not want your subdomain on invoices, checkout pages, or login screens. When HTTPS fails, they do not file a ticket that says “validation reuse expired.” They file a ticket that says your product is broken. The reputational cost sits on their hostname and on your status.
At tens of hostnames, a founder can paste TXT records with the customer on a call. At thousands, the only scalable proof is a protocol: CNAME to a name you control, HTTP-01 on an origin you control, or DNS-01 via a token the customer will not give you. Each proof has a drift mode. CNAME gets deleted. HTTP-01 gets blocked by a customer WAF. DNS-01 never happens because the customer’s DNS host has no API.
Shorter public lifetimes multiply every incomplete state machine. A tenant stuck in pending is an onboarding problem. A tenant that was active and silently failed renewal is an incident. Webhooks that only notify your Slack, and never write https_ready = false on the tenant, hide the incident from the only UI the customer looks at.
There is also a security shape. Issuing a certificate for a hostname the customer does not control is a mis-issuance you caused. The Baseline Requirements bind the CA; they do not forgive an applicant who asked for a name they could not prove. Your onboarding must fail closed.
Technical background
SNI. The TLS client sends the hostname it wants. Your edge must select a certificate that includes that name. A shared “platform” certificate for *.yourapp.com does not cover shop.customer.com. Wildcard certificates cover one label under a zone you control (*.yourapp.com), not a customer’s zone. A multi-tenant edge is a certificate map, not a single PEM.
Ownership vs. issuance. Ownership is your product’s confidence that this tenant may use this hostname. Issuance is a CA’s confidence that the applicant controlled the identifier at validation time. They are related and not identical. A TXT token you invented (own_…) proves the tenant can edit DNS. An ACME HTTP-01 token proves that whoever answers on port 80 can serve a file. You usually need both: the first so you do not issue into a stranger’s tenant row, the second so the CA will sign.
Delegation patterns.
- CNAME to a platform hostname. The customer points
shop.customer.comatedge.example-platform.net(or a per-tenant target). You terminate TLS on your edge. HTTP-01 can work if the CNAME is in place and your edge serves the challenge. DNS-01 works only if you can write to the customer’s zone, which you usually cannot. - CNAME plus a separate ownership TXT. Common when you want proof before you start answering on the name.
- A/AAAA at the customer, origin at you. The customer keeps the name at their DNS and points it at your anycast. Same TLS problem, plus whatever CDN sits in the middle.
- Customer-managed certificate upload. The customer pastes PEM. You did not issue. You still have to inventory
notAfterand refuse to call the name “handled.”
ACME challenges (RFC 8555). HTTP-01 fits the CNAME-to-you model: the CA follows DNS to your edge and fetches /.well-known/acme-challenge/. DNS-01 fits wildcards and names that will never answer on port 80; it requires a write to _acme-challenge in a zone you almost never own. tls-alpn-01 fits edges that already speak TLS and do not want port 80. Wildcards cannot use HTTP-01.
CAA (RFC 8659). The customer’s zone may say issue "letsencrypt.org" or issue "digicert.com" or nothing. If they restrict issuance to a CA you do not use, your order fails. Onboarding should check CAA and say so in the tenant UI.
MPIC. CAs increasingly validate from multiple network perspectives. A challenge that only works from one region, or only on IPv4, will fail more often as those checks tighten. Customer WAFs that allowlist a single CA IP are already the wrong design.
Lifetimes. New public leaves: 200 days from 15 March 2026, 100 days from 15 March 2027, 47 days from 15 March 2029. Reuse of domain-control evidence follows 200 / 100 / 10 days. Your “we validated at signup” flag is not evidence the CA will accept next quarter.
Operational consequences
DNS drift after go-live. The customer deletes the TXT, points the CNAME at a former vendor, or moves registrars. The next issuance fails. If you only check DNS at onboarding, you will learn this at notAfter.
Challenge path vs. application path. HTTP-01 must not fall through to the tenant’s application, which may 302 everything to HTTPS or to a login page. Serve challenges at the edge, before application routing.
Shared SAN blast radius. Putting 100 customer hostnames on one certificate makes one validation failure block 99 unrelated tenants, and makes one leaked key a 100-tenant incident. Prefer one certificate per hostname unless you have a measured reason not to.
Deploy to the actual listener. Issuing into object storage does not update the SNI map. The process that answers on 443 has to load the new leaf. At thousands of hostnames this is a config or an API, not a reload of one Nginx file.
Rate limits. Adding 10,000 new customer names in a week is a new-order event at the CA, not a renewal. Let’s Encrypt’s published limits treat new name sets differently from renewals. Stagger onboarding. Implement ARI replaces for renewals.
Customer support. The UI must show the exact record to create, the last error from the CA in language a human can use, and whether HTTPS is currently served. “Pending” without a reason is a ticket.
Compliance and abuse. Attackers will try to onboard hostnames they do not own. Rate-limit onboarding. Expire unused ownership tokens. Do not issue because a sales engineer said the deal is closing.
Multi-CDN and bring-your-own-edge. Some customers will want the name to stay on their CDN. Then you are not the TLS terminator. Be honest: either they upload a certificate, or their CDN issues one, and your inventory is monitoring-only.
Affected audiences
SaaS product and platform teams. This is your architecture. The text box on the settings page is the user-visible fraction.
Support and success. You will explain CNAME, CAA, and “your IT deleted the record” more often than engineering expects. Give them a UI, not a runbook only engineering can read.
Customer IT. They own DNS and sometimes a WAF. They will not join your Slack. Instructions have to survive a forwarding chain.
Security. Custom domains expand the certificate inventory to names you do not own. Mis-issuance, leftover hostnames after churn, and wildcard temptation are your problems.
Hosting and agency partners who resell a SaaS with custom domains. They sit between your state machine and the customer’s registrar.
Implementation options
Platform-terminated, HTTP-01, CNAME to you. The common pattern. Customer CNAMEs the hostname to a target you publish. You serve challenges and the application. You issue a per-hostname DV leaf. You renew as long as the CNAME remains.
Platform-terminated, DNS-01 via CNAME delegation of _acme-challenge. The customer CNAMEs _acme-challenge.shop.customer.com to a name under a zone you control. You write TXT there. This survives a customer WAF and does not require port 80. It requires the customer to keep that one CNAME forever.
Customer-terminated. The customer (or their CDN) holds the certificate. You provide a TXT for app-level ownership if you still need it. You do not issue. You may probe their endpoint for expiry as a courtesy.
Upload. The customer gives you PEM and a key, or a CSR you sign against a CA. Key handling becomes your HSM problem. Prefer CSR if they will not let the key leave their environment.
Wildcard on the customer zone. Almost always the wrong answer. It requires DNS-01 on a zone you do not operate, and it puts every subdomain of the customer on one key.
Pick one primary path and one escape hatch. Five half-implemented paths produce five classes of stuck tenants.
Recommended practices
Model a state machine and persist it: pending (instructions issued) → certificate_pending (ownership seen, order created) → active (handshake serves the leaf) → renewing → active, with failed states that keep the last instruction. If your API has no public validate route, do not add a button that pretends otherwise; when validation is a side effect of DNS becoming correct, say that.
Publish a stable cname_target. Changing it later is a fleet migration of customer DNS.
Issue one certificate per customer hostname unless you have measured SAN grouping and accepted the blast radius.
Serve ACME HTTP-01 at the edge, on HTTP, without a redirect to a login.
Check CAA at onboarding and at renewal. Explain a CAA failure as CAA, not as “unknown error.”
Detect drift on a schedule shorter than your lead time. If the CNAME is gone, mark the tenant before the CA does.
Write renewal failure onto the tenant. A webhook to your ops channel is not the product.
When a tenant leaves, stop answering on their hostname and stop renewing. Leftover certificates for departed customers are how you become an unexpected CA applicant for a name that now belongs to someone else.
Do not require a CDN cutover if you do not operate a CDN. “Point this CNAME at our edge” is a DNS instruction, not a CDN product claim.
Prefer Let’s Encrypt Staging (Test) for integration tests of the state machine, and Let’s Encrypt Production (Live) for customer hostnames. Never serve an untrusted Staging leaf to a customer who thinks they are in production.
Architecture and checklist
tenant types hostname
→ store row + ownership token + cname_target
→ wait until ownership proof is visible
→ ACME order (HTTP-01 at edge, or delegated DNS-01)
→ install leaf on SNI map
→ handshake verify → mark active
→ schedule from notAfter (and ARI if the CA offers it)
→ on failure: tenant.https = false + customer-visible reason
Design checklist
- Hostname is a first-class entity with a state, not a string on the account.
- Ownership token and CNAME target are returned at create time.
- Challenge handling does not depend on the tenant application.
- One leaf per hostname, unless a written exception exists.
- Deploy updates the SNI map; issuance alone cannot mark
active. - Handshake verify uses the customer hostname, not your canonical name.
- Drift detection runs inside the renewal lead time.
- CAA is checked and explained.
- Renewal failure is visible to the customer and to you.
- Offboarding stops issuance and TLS answers.
- Rate limits and new-order bursts are modelled.
- Test (Let’s Encrypt Staging) exercises the machine; Live is Production.
- The 15 March 2027 100-day maximum is in the capacity plan.
Onboarding instructions that survive support
Show the exact records:
shop.customer.com. CNAME tenants.edge.example.net.
_acme-challenge.shop… CNAME <optional delegation>
<ownership name> TXT own_…
Show a “last checked” timestamp and the last error. Do not show a green tick because the customer clicked “I did it.”
How platforms and tools can help
ACME clients issue. They do not onboard a tenant. You still need a hostname table, a proof, an SNI map, and a customer UI.
CDNs with “custom hostname” products solve termination if you are willing to put every tenant on that CDN. That is an architecture choice. It is not mandatory, and it is not free of the same ownership and drift problems.
Control planes that already issue, store inventory, and fire webhooks can sit under your tenant table: you create a hostname row, they create an order, you map SNI when the leaf exists, you react to renewal_failed. You still own the tenant state.
Certificate Transparency can show you a leaf someone else issued for a hostname you thought you had. That is useful. It is not a substitute for probing the name you serve.
Where a lifecycle platform fits
Teams that already operate reliable ACME, deployment and monitoring may not need another issuance layer. Many SaaS stacks already have cert-manager or a CDN hostname API. A lifecycle platform is useful when you want organization-scoped orders, a Test directory (Let’s Encrypt Staging) and a Live directory (Let’s Encrypt Production), webhooks into the tenant table, and inventory of names you issued plus names you only monitor. sslcertificates.io is one possible layer for that glue. It will not CNAME the customer’s zone for you, and it will not mark HTTPS ready because an order returned PEM.
What to watch next
100-day and 47-day maxima (15 March 2027, 15 March 2029). Renewal and reuse become the product.
CAA accounturi / validationmethods. If the Forum requires them on a 2027 timeline, customer zones that set CAA will need more specific records. Re-read the ballot when it is effective.
dns-persist-01. A persistent DNS authorization would reduce repeated challenge writes for names you can write to. Most SaaS names you cannot. Do not plan the product around a draft.
MPIC tightening. Regional or IPv6-only challenge failures will increase. Serve challenges everywhere you terminate.
Customer-held keys and BYOCA. Enterprise tenants will ask. CSR mode is the honest answer; uploading their private key is not.
Sources
- RFC 8555 — challenges, identifiers, wildcards.
- RFC 8659 — CAA.
- CA/Browser Forum TLS Baseline Requirements — lifetime and DCV reuse.
- Let’s Encrypt documentation — HTTP-01, DNS-01, rate limits, profiles.
Related reading
Primary sources
- RFC 8555 — Automatic Certificate Management Environment
- CA/Browser Forum TLS Baseline Requirements
- RFC 8659 — DNS Certification Authority Authorization (CAA)
- Let’s Encrypt documentation
Related reading
When a lifecycle platform is worth it
Teams that already operate reliable ACME, deployment and monitoring workflows may not need another issuance layer. A lifecycle platform becomes more useful when central state, multi-tenant operations, deployment verification or provider abstraction become operational requirements.