Blog | G5 Cyber Security

Fix Browser Certificate Mismatch Error

TL;DR

Your browser is complaining about a certificate mismatch, but only sometimes? This usually means something’s off with how your server presents its certificates (chaining issues) or the hostname doesn’t quite match what’s in the cert. Here’s how to fix it.

1. Understand the Problem

A certificate mismatch error happens when your browser can’t verify that the website you’re visiting is who it says it is. This usually means one of these things:

The fact it only happens *sometimes* suggests a configuration issue, not a fundamental problem with your certificate itself.

2. Check Your Server Configuration

The exact steps depend on your web server (Apache, Nginx, IIS etc.). We’ll cover the most common ones.

Apache

  1. Check Virtual Host: Make sure your virtual host configuration includes the correct ServerName and ServerAlias directives.
  2. SSLCertificateChainFile: This is crucial! Add or update this directive in your virtual host file to point to a file containing intermediate certificates (usually provided by your certificate authority). Example:
    SSLCertificateChainFile /path/to/your/intermediate.crt
  3. Restart Apache: After making changes, restart the server.
    sudo systemctl restart apache2

Nginx

  1. Check Server Block: Verify your server_name directive in your Nginx configuration.
  2. ssl_certificate and ssl_certificate_key: Ensure these point to the correct certificate and key files.
  3. ssl_trusted_certificate: Add this directive pointing to your intermediate certificates file.
    ssl_trusted_certificate /path/to/your/intermediate.crt;
  4. Restart Nginx: Restart the server after changes.
    sudo systemctl restart nginx

IIS (Windows Server)

  1. Certificate Binding: Open IIS Manager, select your website, and go to Bindings.
  2. Check Hostname: Ensure the hostname in the binding matches the certificate’s name(s).
  3. Complete Certificate Chain: In IIS Manager, double-click on the certificate. The ‘Certification Path’ tab should show a complete chain back to a trusted root authority. If it doesn’t, you need to import the intermediate certificates into the Windows certificate store (usually via MMC).
    • Open mmc.exe
    • Add the Certificates snap-in for ‘Local Computer’ account.
    • Navigate to ‘Intermediate Certification Authorities’.
    • Import your intermediate certificate file.
  4. Restart IIS: Restart the server.
    iisreset

3. Verify Certificate Details

Use an online SSL checker to see exactly what certificates your server is sending and if there are any issues.

Pay attention to the ‘Chain’ section – it should show a complete chain of trust.

4. Clear Browser Cache

Sometimes, your browser caches old certificate information. Clearing the cache can resolve the issue.

5. Check DNS Records

Ensure your DNS records (A, CNAME) point to the correct IP address for your server.

Exit mobile version