How We Handle SSL Certificate Provisioning at Scale | Deployxa

Provisioning SSL certificates for thousands of custom domains is tricky. Here is how Deployxa handles it at scale, with automatic renewal and failure recovery.

← Back to Dispatch Articles
Engineering Log

How We Handle SSL Certificate Provisioning at Scale

Provisioning SSL certificates for thousands of custom domains is tricky. Here is how Deployxa handles it at scale, with automatic renewal and failure recovery.

How We Handle SSL Certificate Provisioning at Scale

SSL certificates are essential for production apps: they encrypt traffic, they build user trust, and they are a Google ranking factor. But provisioning and renewing SSL certificates for thousands of custom domains is a non-trivial engineering challenge. Let's Encrypt certificates expire every 90 days, which means we need to renew them continuously. The renewal process can fail for various reasons (DNS issues, rate limits, network errors), and a failed renewal means users see SSL warnings, which destroys trust. Here is how Deployxa handles SSL certificate provisioning at scale, with automatic renewal, failure recovery, and monitoring.

The direct answer is that Deployxa uses Let's Encrypt for SSL certificate provisioning, with an automated pipeline that handles certificate issuance, renewal, and failure recovery. The pipeline runs continuously, checking for certificates that are about to expire and renewing them proactively. If a renewal fails, the pipeline retries with exponential backoff, and if all retries fail, it alerts the operations team. The pipeline handles thousands of custom domains, with a renewal success rate of over 99.9 percent. For more on Deployxa's infrastructure, see our article on Traefik v3 dynamic routing.

The SSL Certificate Lifecycle

An SSL certificate has three lifecycle stages:

1. Issuance

When a user adds a custom domain, Deployxa provisions a new SSL certificate via Let's Encrypt. The issuance process uses the HTTP-01 challenge: Deployxa serves a specific file on the domain, and Let's Encrypt verifies it to confirm domain ownership. Once verified, Let's Encrypt issues the certificate, which Deployxa installs in the Traefik v3 reverse proxy.

2. Renewal

Let's Encrypt certificates expire every 90 days. Deployxa renews certificates proactively, starting 30 days before expiration. The renewal process uses the same HTTP-01 challenge as issuance. Once renewed, the new certificate is installed in Traefik, replacing the old one.

3. Revocation (rare)

In rare cases (e.g., a security incident, a domain transfer), a certificate might need to be revoked. Deployxa revokes the certificate via the Let's Encrypt API and removes it from Traefik.

The Architecture

The SSL provisioning system has four main components:

1. The certificate manager

The certificate manager is a service that runs continuously, checking for certificates that need to be issued or renewed. It maintains a queue of tasks (issue, renew, revoke) and processes them in order.

2. The Let's Encrypt client

The Let's Encrypt client (we use certbot or acme-client, depending on the language) handles the ACME protocol (the protocol used to communicate with Let's Encrypt). It performs the HTTP-01 challenge, downloads the certificate, and installs it in Traefik.

3. The Traefik integration

Traefik v3 supports dynamic certificate loading, which means certificates can be added, updated, and removed without restarting. The certificate manager updates Traefik's certificate store via the Traefik API, which triggers a hot reload.

4. The monitoring and alerting system

The monitoring system tracks the certificate manager's health, the certificate expiration dates, and the renewal success rate. If a renewal fails repeatedly, or if a certificate is about to expire without a successful renewal, the system alerts the operations team.

Step-by-Step: How a Certificate Is Provisioned

Here is how a certificate is provisioned for a new custom domain.

Step 1: The user adds a custom domain

In the Deployxa dashboard, the user adds a custom domain (e.g., myapp.com) to their app. Deployxa responds with a CNAME record that the user needs to add to their DNS provider.

Step 2: The user configures DNS

The user adds the CNAME record to their DNS provider, pointing myapp.com to cname.deployxa.app. DNS propagation takes a few minutes to a few hours.

Step 3: The certificate manager detects the new domain

The certificate manager detects the new domain and adds an issuance task to the queue.

Step 4: The Let's Encrypt client runs the HTTP-01 challenge

The Let's Encrypt client requests a certificate from Let's Encrypt, which responds with an HTTP-01 challenge. The client serves the challenge file on myapp.com/.well-known/acme-challenge/{token}, and Let's Encrypt verifies it.

Step 5: Let's Encrypt issues the certificate

Once the challenge is verified, Let's Encrypt issues the certificate. The client downloads the certificate and the private key.

Step 6: The certificate is installed in Traefik

The certificate manager installs the certificate in Traefik's certificate store via the Traefik API. Traefik performs a hot reload, and the certificate is now serving traffic for myapp.com.

Step 7: The user is notified

The dashboard shows the certificate as "Active", and the user is notified that their custom domain is live with SSL.

Common Pitfalls and Troubleshooting

The first pitfall is DNS propagation. The HTTP-01 challenge requires the domain to resolve to Deployxa's infrastructure, which means DNS must be propagated before the challenge can run. If DNS is not propagated, the challenge fails. The fix is to wait for DNS propagation (typically a few minutes to a few hours) and to retry the challenge. The second pitfall is Let's Encrypt rate limits. Let's Encrypt has rate limits (e.g., 50 certificates per registered domain per week, 5 duplicate certificates per week), which means you cannot issue unlimited certificates. The fix is to cache certificates and to avoid unnecessary re-issuance. The third pitfall is the HTTP-01 challenge for apex domains. The HTTP-01 challenge requires the domain to serve HTTP traffic on port 80, which some DNS providers (e.g., those that proxy traffic) do not support. The fix is to use the DNS-01 challenge instead, which verifies domain ownership via DNS records. The fourth pitfall is certificate installation failures. If Traefik's certificate store is unavailable (e.g., due to a network issue), the certificate cannot be installed, which means the old certificate (or no certificate) is served. The fix is to retry the installation with exponential backoff, and to alert the operations team if the installation fails repeatedly. The fifth pitfall is certificate expiration without renewal. If the renewal process fails repeatedly, the certificate expires, and users see SSL warnings. The fix is to monitor the certificate expiration dates and to alert the operations team 7 days before expiration if the renewal has not succeeded.

Scaling to Thousands of Domains

Scaling SSL provisioning to thousands of domains requires careful attention to performance and reliability. The first optimization is parallel processing. The certificate manager processes multiple tasks in parallel (e.g., 10 at a time), which means multiple certificates can be issued or renewed simultaneously. The second optimization is caching. The certificate manager caches the Let's Encrypt client's state (e.g., the account key, the rate limit counters), which avoids redundant work. The third optimization is batching. For domains that share a certificate (e.g., myapp.com and www.myapp.com), the certificate manager issues a single certificate with multiple Subject Alternative Names (SANs), which reduces the number of certificates needed. The fourth optimization is monitoring. The monitoring system tracks the certificate manager's health (queue length, processing time, error rate) and the certificate expiration dates, which lets the operations team identify and fix issues before they affect users. The fifth optimization is redundancy. The certificate manager runs on multiple servers, with a leader-follower model that ensures high availability. If the leader fails, a follower takes over, and the certificate provisioning continues without interruption.

How SSL Provisioning Integrates with the Readiness Engine

The SSL certificate check is one of the 14 checks in the readiness engine. The check verifies that the SSL certificate for the custom domain is valid, not expired, and not expiring soon (within 30 days). If the certificate is invalid or expiring, the check fails, and the readiness grade drops. This ensures that SSL issues are caught before they affect users. For more on the readiness engine, see our article on the 14-point readiness engine.

Advanced SSL Patterns

Beyond the basics, SSL provisioning benefits from several advanced patterns. The first is wildcard certificates. For apps with many subdomains (e.g., app1.myapp.com, app2.myapp.com), a wildcard certificate (*.myapp.com) covers all subdomains, which reduces the number of certificates needed. The second is DNS-01 challenge. The HTTP-01 challenge requires the domain to serve HTTP traffic on port 80, which some DNS providers (e.g., those that proxy traffic) do not support. The DNS-01 challenge verifies domain ownership via DNS records, which works for all domains. The third is certificate transparency monitoring. Certificate transparency logs record all SSL certificates issued by Let's Encrypt, which means you can monitor them for unauthorized certificates. The fix is to use a service like CertSpotter to monitor for unauthorized certificates for your domains. The fourth is OCSP stapling. OCSP (Online Certificate Status Protocol) lets the browser check if a certificate is revoked, but it adds a round-trip. OCSP stapling includes the OCSP response in the SSL handshake, which eliminates the round-trip. The fifth is HSTS (HTTP Strict Transport Security). HSTS tells the browser to always use HTTPS, which prevents downgrade attacks. The fix is to set the Strict-Transport-Security header. For more on SSL, see our articles on Traefik v3 dynamic routing and the 14-point readiness engine.

When SSL Automation Is Not Needed

SSL automation is not always needed. For internal tools (e.g., admin dashboards) that are only accessed on a private network, SSL might not be necessary (though it is still recommended). For hobby projects that do not handle sensitive data, SSL might be optional. For apps that use a CDN that handles SSL (e.g., Cloudflare's Flexible SSL), SSL automation at the origin is not needed (though Full Strict SSL is recommended). For most production apps, SSL automation is essential, because it encrypts traffic, builds user trust, and is a Google ranking factor. For more on production patterns, see our articles on the cost optimization engine and how we built the dashboard.

Conclusion: SSL at Scale Is Solved

Provisioning and renewing SSL certificates for thousands of custom domains is a non-trivial engineering challenge, but it is solvable with the right architecture. Deployxa's SSL provisioning system handles issuance, renewal, and failure recovery automatically, with a renewal success rate of over 99.9 percent. By automating SSL, we let developers focus on their apps instead of their certificates. For more on Deployxa's engineering, see our articles on Traefik v3 dynamic routing and the auto-detection engine. Learn about the cost optimization engine and building Deployxa's documentation in our companion articles. Explore our free developer tools to speed up your workflow. Try Deployxa Drop for an instant live preview with zero signup.

Ready to deploy with Deployxa?

Deploy your apps globally with automatic SSL and AI diagnostics.

Start Free Now