How Wildcards and SANs Work in TLS Certificates

A TLS certificate can identify more than one hostname through its Subject Alternative Name, or SAN, extension. Some SAN entries name a specific hostname, while a wildcard DNS entry can match certain names one label below a parent. These are not competing certificate types: a wildcard is a form of DNS identity that can appear inside the SAN alongside explicit identities.
A client's requested hostname must match at least one valid identity in the certificate. A wildcard does not cover the parent name itself or every deeper subdomain. Include exact names wherever the selected wildcard pattern cannot cover a required hostname.
Names and Addresses in the SAN
The SAN extension binds identities to a certificate. For a website, a dNSName entry can identify a hostname such as example.com or www.example.com. A certificate can contain several such entries. It can also contain other identifier types, such as an IP address identity, when appropriate. The client compares the name or address it intended to reach against the relevant entry type.
For example, a certificate could contain example.com, www.example.com, and api.example.com as separate DNS identities. This is often called a multi-name certificate. Its SAN list can also include a wildcard alongside the exact names.
For current TLS service identity verification, DNS names are checked against dNSName entries in SAN. A Common Name in the subject field is not a substitute when the SAN lacks the requested hostname. When troubleshooting, inspect the actual SAN list presented by the endpoint, not only the certificate's display name in a control panel.
One Wildcard Matches One Label
A wildcard DNS identity such as *.example.com can match www.example.com or shop.example.com. Under the TLS service identity matching rule, the asterisk must be the entire leftmost label and matches only one label. It does not match example.com, because there is no label in that position. It also does not match api.eu.example.com, because that adds two labels before the parent.
This is certificate matching, not DNS wildcard behavior. DNS can synthesize answers from wildcard records under its own rules, but that does not expand what a TLS client accepts from a certificate. A DNS answer may direct api.eu.example.com to a server while a certificate for *.example.com still fails the name check. Keep routing and identity validation separate.
The *.example.com entry does not cover names under an unrelated domain. The matching suffix must be the same, and the wildcard occupies only one label. Some application protocols can restrict wildcard use further, so confirm the requirements of the client and service being deployed.
Combine Explicit and Wildcard Names
Suppose a site needs example.com, www.example.com, and changing first-level names such as store.example.com. A certificate with SAN entries example.com and *.example.com could cover the parent and those one-label children under the normal wildcard rule. The exact parent entry is necessary because the wildcard does not match it.
If the same service also needs api.eu.example.com, add that exact name or use a separate wildcard such as *.eu.example.com for names one label below eu.example.com. The first wildcard, *.example.com, cannot cover it. A certificate can mix these entries when the issuer and validation process permit them. Include only identities the operator is authorized to represent.
A certificate's list of names does not create DNS records or deploy the websites. Each hostname still needs suitable DNS and hosting configuration. Conversely, one web server can present different certificates to different names through TLS server name selection. The right certificate layout depends on who operates the services and how keys are managed.
Protecting Keys and Updating Certificates
The private key for a wildcard certificate may be installed across many services for convenience. That broadens the impact if one copy is exposed: a party holding the key and certificate could impersonate covered hostnames where other conditions allow. Limit where keys are stored and control deployment access. If a key is compromised, report it to the issuer, request revocation where supported, and replace the affected certificates using a new key. Some short-lived certificates do not support revocation. Separate certificates and keys can reduce shared exposure between independently operated services.
The SAN list is part of the signed certificate, so adding or removing a hostname requires a newly issued certificate. Coordinate rollout across the endpoints affected by the change instead of assuming an update on one server changes the others. Track SAN contents, certificate expiry, and ownership of each hostname. A newly added hostname will fail the name check wherever an endpoint still presents a certificate that does not cover it.
The visible certificate is the one presented by the TLS endpoint. A reverse proxy or load balancer may terminate TLS before traffic reaches an application server. Inspect that endpoint's certificate rather than assuming the origin machine's local file is what clients see.
Validation Before Issuance
A public certificate authority, or CA, validates control of requested domain identities under an accepted method before issuing a certificate. For an exact name, several methods may be available depending on the CA and client. Wildcard issuance has additional method constraints. Let's Encrypt uses DNS-01 to validate wildcard names; its HTTP-01 and TLS-ALPN-01 methods cannot validate them.
DNS-01 involves publishing a TXT record with a challenge value in DNS. For renewal automation, use the narrowest DNS API permissions your provider supports and protect the credentials from unauthorized use. Provider and client support can change, so check their current documentation for the planned identity list and validation method. A DNS wildcard record by itself does not establish that a certificate has been issued.
To verify coverage, write down every URL hostname, inspect the presented SAN entries, and compare each exact name against the wildcard rule. Then confirm the trust chain, validity dates, and any revocation status checks required by the client.







