Cloudflare 526 Error: Invalid SSL Certificate
Problem
When using Cloudflare as a reverse proxy, you may encounter a 526 error which indicates an invalid SSL certificate on your origin server.
This happened to me when my website was configured with Cloudflare's SSL/TLS encryption mode set to Full (strict).
Root Cause
Cloudflare offers several SSL/TLS encryption modes:
| Mode | Description |
|---|---|
| Off | No encryption |
| Flexible | Encrypts traffic between browser and Cloudflare only |
| Full | Encrypts end-to-end, but does NOT validate the origin certificate |
| Full (strict) | Encrypts end-to-end AND validates the origin certificate |
The 526 error occurs when:
- Your SSL mode is set to Full (strict)
- Your origin server's SSL certificate is:
- Self-signed
- Expired
- Not issued by a trusted CA
- Not matching the hostname
Solution
If your origin server uses a certificate that cannot be validated (e.g., self-signed, free certificates from certain providers, or certificates not recognized by Cloudflare), change the SSL mode from Full (strict) to Full.
Steps:
- Log in to your Cloudflare dashboard
- Select your domain
- Go to SSL/TLS > Overview
- Change the encryption mode from Full (strict) to Full
When to Use Each Mode
- Full (strict): Use when your origin has a valid certificate from a trusted CA (e.g., Let's Encrypt, DigiCert)
- Full: Use when your origin has a self-signed certificate or a certificate not trusted by Cloudflare
Note: Using Full mode is still secure for most use cases. The traffic between Cloudflare and your origin is still encrypted; it just doesn't validate the certificate chain.
Alternative: Use Cloudflare Origin CA Certificate
If you want to use Full (strict) mode, you can generate a free Cloudflare Origin CA certificate:
- Go to SSL/TLS > Origin Server
- Click Create Certificate
- Install the certificate on your origin server
- This certificate is trusted by Cloudflare and allows Full (strict) mode
References
- Cloudflare SSL/TLS encryption modes. (n.d.). Cloudflare docs. Retrieved December 17, 2025, from https://developers.cloudflare.com/ssl/origin-configuration/ssl-modes/
- 526 Invalid SSL certificate. (n.d.). Cloudflare docs. Retrieved December 17, 2025, from https://developers.cloudflare.com/support/troubleshooting/cloudflare-errors/troubleshooting-cloudflare-5xx-errors/#error-526-invalid-ssl-certificate