Troubleshooting

SSL Certificate Issues — Fix Guide

HTTPS not working? This guide covers the most common SSL certificate problems and how to fix them, including Cloudflare, Let's Encrypt, and mixed content errors.

Last updated: April 2026

Common SSL Errors and What They Mean

  • ▸ERR_SSL_PROTOCOL_ERROR: The server isn't responding on HTTPS at all, or sent a non-SSL response
  • ▸NET::ERR_CERT_AUTHORITY_INVALID: The certificate is self-signed or from an untrusted authority
  • ▸NET::ERR_CERT_COMMON_NAME_INVALID: The certificate doesn't match the domain name
  • ▸NET::ERR_CERT_DATE_INVALID: The certificate has expired
  • ▸Mixed Content: Page loads over HTTPS but some resources load over HTTP
  • ▸ERR_TOO_MANY_REDIRECTS: Often a Cloudflare SSL mode misconfiguration

Fix: ERR_TOO_MANY_REDIRECTS with Cloudflare

This is one of the most common issues with Cloudflare. It happens when Cloudflare is set to "Flexible" SSL but your server also redirects HTTP to HTTPS — creating an infinite redirect loop.

Fix: In Cloudflare Dashboard → SSL/TLS → change mode to "Full" or "Full (Strict)" instead of "Flexible".

Note: The recommended SSL mode is Full (Strict) if your origin server has a valid SSL certificate (e.g., from Let's Encrypt). This encrypts both the connection between visitors and Cloudflare, and between Cloudflare and your server.

Fix: Certificate Expired

Let's Encrypt certificates expire every 90 days. They should auto-renew, but this can fail:

Renew Let's Encrypt certificate manually
# Check current certificate expiry
sudo certbot certificates

# Force renewal
sudo certbot renew --force-renewal

# Test auto-renewal
sudo certbot renew --dry-run

# Check renewal timer
sudo systemctl status certbot.timer

Fix: Certificate Doesn't Match Domain

This happens when the certificate was issued for a different domain, or you're accessing via IP. Ensure your certificate covers the exact domain names being accessed:

Get certificate for your domain
# Get a new cert for your domain
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com

# Or add the domain to an existing cert
sudo certbot --expand -d yourdomain.com -d www.yourdomain.com -d api.yourdomain.com

Fix: Mixed Content Warnings

Mixed content warnings appear when an HTTPS page loads resources (images, scripts, stylesheets) over HTTP. Fix by:

  • ▸Using protocol-relative URLs (//example.com/style.css) or HTTPS URLs everywhere
  • ▸Enabling "Automatic HTTPS Rewrites" in Cloudflare (rewrites HTTP resource URLs to HTTPS)
  • ▸Adding a Content Security Policy header to upgrade all requests
Nginx - force HTTPS with CSP header
# Add to your NGINX server block:
add_header Content-Security-Policy "upgrade-insecure-requests;";

Fix: GitHub Pages SSL Not Working with Cloudflare

GitHub Pages manages its own SSL certificates. When you use Cloudflare, set the record to DNS Only (grey cloud). Cloudflare's proxy interferes with GitHub Pages' SSL certificate issuance via HTTP challenge.

⚠ Warning: With Cloudflare proxying enabled for GitHub Pages, GitHub cannot issue an SSL certificate for your custom domain. Set the CNAME/A record to DNS-only (grey cloud icon) in Cloudflare.