Cloudflare SSL with WordPress
Cloudflare can serve HTTPS for a WordPress site in a few minutes, but the wrong SSL mode is the most common reason sites end up with redirect loops, mixed content or error 525 and 526. This guide covers the setting that matters and the small WordPress changes that go with it.
Cloudflare SSL with WordPress: pick the right mode
| Mode | Visitor to Cloudflare | Cloudflare to your server | Use it? |
|---|---|---|---|
| Off | HTTP | HTTP | No |
| Flexible | HTTPS | HTTP (unencrypted) | Only as a short-term fallback |
| Full | HTTPS | HTTPS, any certificate | Acceptable |
| Full (strict) | HTTPS | HTTPS, valid certificate | Recommended |
Flexible mode leaves the second leg unencrypted, and it is the usual cause of loops: WordPress sees an HTTP request, redirects to HTTPS, Cloudflare sends HTTP again, and the cycle repeats.
Step 1: Install a certificate on the origin
For Full (strict) the server needs a valid certificate. Use a free Let's Encrypt certificate from your host, or a Cloudflare Origin certificate if the site will always stay proxied. Then set the mode under SSL/TLS and Overview.
Cloudflare SSL with WordPress, step 2: site URLs
In Settings and General, change both WordPress Address and Site Address to https://. If you are locked out, set them in wp-config.php:
define('WP_HOME', 'https://example.com');
define('WP_SITEURL', 'https://example.com');
Step 3: Tell WordPress the request was HTTPS
Behind a proxy, PHP may not know the visitor used HTTPS. Add this above the line that says "That's all, stop editing" in wp-config.php:
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
$_SERVER['HTTPS'] = 'on';
}
Step 4: Force HTTPS in one place only
Pick one layer to do the redirect: Cloudflare's Always Use HTTPS setting, or the server, or a plugin. Running two at once makes loops hard to debug. If you prefer the server, our HTTPS redirect generator produces the rules, and the htaccess and Nginx guide explains them.
Step 5: Clean up mixed content
Turn on Automatic HTTPS Rewrites under SSL/TLS and Edge Certificates. It fixes many http:// resources on the fly, but the real fix is to update the stored URLs. See how to fix HTTP internal links after migration.
Verify
- Run the SSL checker on the domain.
- Run
curl -I http://example.comand confirm one 301 to the HTTPS address. - Purge the Cloudflare cache and any WordPress cache plugin after changes.
Common mistakes
Leaving the mode on Flexible "because it worked" is the most frequent one. It hides the problem until you add a login form or a shop. Another is installing a redirect plugin while Cloudflare's Always Use HTTPS is also on, which is harmless on its own but confusing when something breaks.
Also watch caching. Cloudflare can keep serving an old http:// version of a page after you change the settings, so purge the cache. If you use page rules that match http:// URLs only, review them after the change, because some may never match again.
Related reading: Universal SSL against Let's Encrypt, free SSL for WordPress and fixing mixed content warnings.
Frequently Asked Questions
Is Flexible SSL safe for WordPress?
It encrypts only the visitor leg. Logins and form data cross the internet between Cloudflare and your host in plain text, so avoid it for anything with accounts or payments.
Do I need a plugin?
Not for SSL itself. A plugin can help with search and replace of old URLs, but the core settings are Cloudflare and wp-config.php.
Why does wp-admin loop but the front end works?
Usually the missing X-Forwarded-Proto handling above, or Flexible mode combined with FORCE_SSL_ADMIN.
Will HTTPS hurt my SEO?
No, as long as every old HTTP URL 301-redirects to its HTTPS version and your canonicals and sitemap use HTTPS.
Is Flexible mode safe for WordPress?
No. The leg between Cloudflare and your server is plain HTTP, so anyone on that path can read the traffic. Use Full (strict) with a valid certificate on the origin.
Why does wp-admin loop but the front end works?
WordPress sees an HTTP request, redirects to HTTPS, and Cloudflare sends HTTP again. Fix the mode first, then set the site URL to https so WordPress stops rewriting.
Do I need a plugin?
Usually not. Telling WordPress it sits behind a proxy is one line in wp-config.php. A plugin helps when you cannot edit that file.
✅ Post-Installation Verification & SEO Checklist
After applying the steps above, run through this 5-point checklist to prevent browser warnings and protect your Google SEO rankings:
- Verify full CA chain trust and TLS 1.3 support using our Live SSL Checker.
- Scan for Mixed Content HTTP links and check HSTS/CSP headers on Security Headers Checker.
- Enforce a permanent 301 HTTP-to-HTTPS redirect with our HTTPS Redirect Generator.
- Confirm both root and
wwwversions resolve cleanly to one canonical HTTPS URL. - Verify your HTTPS property and
sitemap.xmlinside Google Search Console and Bing Webmaster Tools.