A Subdomain and SSL Certificate for Every SaaS Tenant

The basic architecture for routing tenant subdomains with wildcard DNS and securing them with one certificate.

Omar Alalwi Article

A SaaS platform can organize tenant URLs as paths under its main domain, such as example.com/tenant-1, or as separate subdomains such as tenant-1.example.com. Paths simplify DNS and TLS, while subdomains give each tenant a clearer identity at the cost of additional setup.

In Laravel, domain routing can match {tenant}.{mainDomain}, followed by middleware that validates the tenant, loads its data, and isolates its queries. Names such as www, api, and admin must be reserved so tenants cannot claim them.

At the DNS layer, a wildcard * record points to the server. A certificate covering example.com and *.example.com is then issued and installed with its private key on Nginx, Apache, or the hosting platform. Once the origin certificate is working correctly between Cloudflare and the server, Full (Strict) can provide validated encryption in both directions.

This design avoids issuing a new certificate for every subdomain. Tenant data isolation, host validation, and authorization still remain separate and essential parts of a secure multi-tenant architecture.

Share your perspective

I’d be glad to hear your perspective. Leave a comment on the original article on social media.

Related articles

Application & Infrastructure Security ·

How Cloudflare Uses Lava Lamps in Encryption

Cloudflare uses the movement of lava lamps as an additional entropy source for secure random-number generation in cryptographic systems.

Read article

Application & Infrastructure Security ·

Beware of the disreputable server

Reliable email delivery depends on more than a running server: IP reputation, authentication, and sending policies determine whether messages reach the inbox.

Read article

Application & Infrastructure Security ·

How AML Controls Work in FinTech Systems

FinTech systems balance transaction speed with identity, risk, and behavior checks while minimizing disruption for legitimate customers.

Read article