This site is an archive and is no longer updated.
    Back to Guides
    TroubleshootingSAN

    Certificate Name Mismatch: Why Your Cert Doesn't Match Your Domain

    Name mismatch = the domain you're accessing isn't listed in the certificate's SAN extension.

    10 min read
    LinkedInX
    Certificate name mismatch troubleshooting guide
    Try the Interactive Certificate Name Mismatch

    TL;DR

    Name mismatch means the domain you're accessing isn't listed in the certificate's SAN (Subject Alternative Name) extension. The fix is usually to reissue the certificate with the correct domain(s) or access the right URL.

    What Browsers Check

    When you visit a website, your browser performs a critical security check:

    Certificate says:
    www.example.com
    vs
    You're visiting:
    shop.example.com
    =
    ERROR!

    This check protects you from man-in-the-middle attacks. If an attacker presents a valid certificate for attacker.com while you're trying to reachbank.com, the browser blocks it.

    CN vs SAN Explained

    Certificates have two places where domains can be listed:

    Common Name (CN) - Legacy

    • - Located in Subject field
    • - Only holds one domain
    • - Deprecated - Chrome ignores it since 2017

    Subject Alternative Name (SAN) - Modern

    • + Located in Extensions section
    • + Can hold multiple domains
    • + Required - what all browsers check

    Certificate Structure

    Certificate
    ├── Subject
    │   └── CN = www.example.com    ← Legacy
    └── Extensions
        └── Subject Alternative Name    ← Modern
            ├── DNS: example.com
            ├── DNS: www.example.com
            └── DNS: api.example.com

    Wildcard Certificate Rules

    Wildcard certificates (*.example.com) have specific matching rules that catch many people off guard:

    RuleMatchesDoesn't Match
    One level onlywww.example.comwww.shop.example.com
    Not apex domainapi.example.comexample.com
    Must be leftmost*.example.comwww.*.com
    Can't be partial*.example.comw*.example.com

    Common Gotcha

    If you have *.example.com, you still need example.com as a separate SAN to cover the apex domain!

    Common Error Messages

    Browser/ToolError Message
    ChromeNET::ERR_CERT_COMMON_NAME_INVALID
    FirefoxSSL_ERROR_BAD_CERT_DOMAIN
    Safari"Safari can't verify the identity of..."
    Java"Certificate doesn't match any of the subject alternative names"
    curl"SSL certificate problem"

    Diagnosing the Problem

    1. 1Check the exact URL you're accessing - is it www or non-www?
    2. 2View the certificate's SAN extension (see OpenSSL commands below)
    3. 3Is your domain listed? Check for typos, www vs non-www
    4. 4For wildcards: are you on a subdomain? Is it multi-level?
    5. 5Verify the correct certificate is installed on the server

    How to Fix It

    ProblemSolution
    Wrong domain on certReissue with correct domain(s)
    Missing www or apexAdd both to SAN
    Wildcard not covering apexAdd apex as explicit SAN
    Multi-level subdomainUse explicit SAN, not wildcard
    Wrong cert installedInstall correct cert for this domain
    SNI misconfigurationCheck server SNI settings

    Prevention

    • Always include both example.com AND www.example.com
    • Use SAN extension, not just CN
    • Test certificate before deploying
    • Document which domains each cert covers
    • Consider wildcard + apex combo for flexibility

    OpenSSL Commands

    Check SAN Extension

    openssl s_client -connect example.com:443 </dev/null 2>/dev/null | \
      openssl x509 -noout -text | grep -A1 "Subject Alternative Name"

    Check Common Name

    openssl s_client -connect example.com:443 </dev/null 2>/dev/null | \
      openssl x509 -noout -subject

    Related Resources