Why Does My Subdomain Show a Certificate Name Error?
When a browser shows a warning such as NET::ERR_CERT_COMMON_NAME_INVALID, "Your connection is not private" or "certificate name mismatch" on a subdomain, it nearly always means the certificate the server presented does not list that exact host name in its Subject Alternative Name (SAN) field. Common reasons are that the certificate was issued only for the main domain, that a wildcard does not reach a deeper subdomain, that the server is presenting a default certificate because it has no site configured for that name, or that a CDN or hosting platform has not finished issuing a certificate for the new name. The fix is to get a certificate that covers the name and make sure the server serving that name actually uses it.
How browsers decide whether a certificate matches
Modern browsers compare the host name in the address bar with the DNS names in the certificate's SAN extension. They no longer rely on the older Common Name field. A match must be exact, apart from a wildcard in the left-most position, which covers exactly one label. So a certificate for example.com does not cover shop.example.com, and *.example.com covers shop.example.com but not api.shop.example.com or example.com itself. The card on multi-level subdomains explains the one-label rule.
The usual causes
| Cause | How it shows up | Typical fix |
|---|---|---|
Certificate covers only the apex or www | SAN list has example.com and www.example.com only | Reissue with the subdomain added, or issue a separate certificate |
| Wildcard does not reach the level | Name is two levels down from the wildcard | Add the exact name or a deeper wildcard |
| No site configured for the name | Server returns its default site's certificate | Add a virtual host or site for the subdomain with its own certificate |
| Certificate still being issued | New name on a CDN or platform shows the provider's certificate for a while | Wait for issuance to complete; check that DNS validation records are correct |
| DNS points somewhere unexpected | Certificate belongs to a different service entirely | Correct the A, AAAA or CNAME record |
| Expired or not-yet-valid certificate | Different error, such as ERR_CERT_DATE_INVALID | Renew, and check server clocks |
Checking what the server presents
- In the browser, open the certificate viewer from the address bar and read the list of names. The notes on debugging subdomains with browser developer tools show where to find it.
- From a terminal, ask the server directly, sending the right name with SNI:
openssl s_client -connect shop.example.com:443 -servername shop.example.com, then inspect the certificate's subject and SAN entries in the output. - Check DNS, with
dig shop.example.com, to confirm the name points where you expect. - Look at certificate transparency logs, which publicly record certificates issued by public authorities, to see whether a certificate for the name has been issued at all. The background paper on certificate transparency explains how these logs work and what they reveal.
Why the server sends the wrong certificate
A single server often hosts many names on one IP address. During the TLS handshake the browser sends the requested name using Server Name Indication (SNI), and the server picks the matching site and certificate. If no site is configured for shop.example.com, the server falls back to its default site and presents that site's certificate, hence the mismatch. The same fallback explains why a new subdomain sometimes shows the main website instead of the new content. Configuring a dedicated site for the subdomain fixes both. The guide to pointing a subdomain at your own server covers this setup.
Getting a certificate that covers the name
- Single names: most certificate authorities, including free automated ones such as Let's Encrypt, can issue a certificate for the exact subdomain once DNS points to your server, using HTTP-based validation.
- Many names: list several names as SANs on one certificate, or use a wildcard for one level.
- Wildcards: require DNS-based validation, described in issuing a wildcard certificate with DNS-01.
- Hosted platforms: follow the platform's custom-domain steps exactly, including any verification record, as the Q&A on HTTPS certificates for subdomains describes.
Do not train people to click through
It is tempting to tell colleagues to "just click Advanced and proceed" while a certificate is fixed. Avoid it. A certificate warning is exactly what users should stop for when an attacker is intercepting traffic, and teaching people to ignore it undermines that protection. If the subdomain uses HSTS, browsers will not offer a click-through at all. Fix the certificate instead.
After the fix: a short checklist
- Reload in a private window, or another browser, to rule out cached errors.
- Confirm the certificate's SAN list includes the exact name, and check its expiry date.
- Check that automatic renewal is configured for the new certificate, so the problem does not return in a few weeks.
- Test the name with and without
www, and any other aliases users might type. - Add the name to your subdomain register and certificate monitoring.
Frequently asked questions
Does my main domain's certificate cover subdomains?
Only if they are listed in it, either by exact name or through a wildcard for that level.
Why does the subdomain work on one network but not another?
Often DNS caching: one resolver still returns an old address that serves a different certificate. Check the answer from each network.
Is "not secure" always a certificate name problem?
No. It can also mean the page loads over HTTP, or that an HTTPS page includes insecure content. Check the exact message.
The SubDoms study hub places this card in the HTTPS module.