On this page
What this issue is
Your origin is the server that hosts your site. A CDN (content delivery network, such as Cloudflare) sits in front of it. With Flexible SSL, the visitor connects to the CDN over HTTPS, but the CDN connects to your origin over plain HTTP.
- VisitorOpens https://example.com
- CDN (Flexible)Asks origin over http://
- OriginSees HTTP, redirects to https://
- Page and formNever loads
- Lead or saleNever happens
The visitor never gets past the CDN and origin arguing about the protocol.
Why it costs you leads or sales
Example: 1,000 paid clicks a day before and after a loop starts. Numbers are illustrative.
How to check if your site has it
Open the page in a private window
Visit your HTTPS address. A loop shows a browser error about too many redirects. Clearing cookies can matter, as some loops come from cookies, so test in a fresh private window.
Trace the redirects with curl
Run the command below. If the same Location header repeats until curl stops, you have a loop.
Check the CDN SSL modeCloudflare
In Cloudflare, open SSL/TLS > Overview. If it says Flexible and your origin forces HTTPS, that is the cause.
Test the origin directly
If you can reach the origin by its IP or a non-proxied hostname, check whether it redirects HTTP to HTTPS. If it does, Flexible mode will loop.
curl -sIL --max-redirs 10 https://example.com/ | grep -iE '^(HTTP|location)'How to fix it
Install a certificate on the origin
Use your host's free SSL option, Let's Encrypt, or a CDN-issued origin certificate. Check that it covers your domain and www.
Change the CDN SSL modeCloudflare
In Cloudflare, go to SSL/TLS > Overview and choose Full (strict). Use Full only if the origin has a self-signed certificate you cannot replace yet.
Remove duplicate redirect rules
Keep one place that forces HTTPS: the CDN (Always Use HTTPS) or the origin, not conflicting rules in several places.
Purge the CDN cache
Cached redirect responses can keep the loop alive. Purge everything after the change.
Check the URLs
Go to Settings > General and make sure WordPress Address and Site Address both start with https://.
Trust the forwarded header
Add the snippet below to wp-config.php above the line 'That's all, stop editing'. It tells WordPress the visitor used HTTPS when the CDN says so.
Review SSL plugins
If a plugin such as an SSL or redirect plugin forces HTTPS, check its setting for 'detect HTTPS via header' or turn off its redirect and let the CDN handle it.
Read the forwarded protocol
Only redirect when the X-Forwarded-Proto header is http, not on every plain-HTTP connection from the CDN. See the nginx example below.
Remove blanket rewrites
In Apache .htaccess, a rule that checks only HTTPS being off will loop behind Flexible SSL. Add a check on X-Forwarded-Proto.
Avoid a second proxy conflict
Shopify manages HTTPS itself. If a CDN proxies your Shopify domain, set it to Full (strict) or turn the proxy off for that record. Under Settings > Domains, check the domain's SSL status.
Check the SSL setting
In Project settings > Hosting, confirm SSL is enabled. If a CDN proxies the domain, set it to Full (strict) rather than Flexible.
Review the domain connection
If you point a proxied domain at Wix, set the CDN mode to Full (strict) or switch the DNS record to DNS only. Wix serves HTTPS itself.
Check SSL and proxying
Under Settings > Domains > SSL, keep Secure enabled. If a CDN proxies the domain, use Full (strict) or DNS only.
if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ) {
$_SERVER['HTTPS'] = 'on';
}if ($http_x_forwarded_proto = "http") {
return 301 https://$host$request_uri;
}How to confirm it's fixed
- curl -sIL shows a single 301 from http:// to https:// and then a 200
- Both example.com and www.example.com load without errors
- A private browser window loads the landing page and the form
- Submitting a test form works and the thank-you page loads
- The CDN SSL mode shows Full (strict)
- Cache purged and checked from a different network or device
How to prevent it happening again
- Use Full (strict) as the default SSL mode on every site behind a CDN
- Force HTTPS in one place only
- Re-test key pages after changing SSL plugins, hosts, DNS or CDN settings
- Renew origin certificates on time, because an expired one can push people back to Flexible
- Note the SSL mode in your site handover documents
How FunnelGuard handles this
Questions people ask
Why does my site say "too many redirects" after I turned on HTTPS?
Most often your CDN is on Flexible SSL while your server or a plugin forces HTTPS. The CDN reaches your server over HTTP, the server redirects to HTTPS, and this repeats. Switch the CDN to Full (strict) with a valid origin certificate.
How do I fix ERR_TOO_MANY_REDIRECTS on Cloudflare?
Go to SSL/TLS > Overview and change Flexible to Full (strict), after installing a valid certificate on your origin. Then remove duplicate HTTPS redirects and purge the cache. Test with a private window and curl.
What is the difference between Flexible, Full and Full (strict) SSL?
Flexible encrypts only visitor-to-CDN traffic. Full encrypts both legs but accepts any origin certificate, even self-signed. Full (strict) also requires a valid, trusted certificate on the origin, and is the safest choice.
Can a redirect loop hurt my Google Ads or SEO?
Yes. Ad clicks land on an error page, so you pay for visits that cannot convert. Search crawlers also cannot read looping pages, which can hurt indexing if it lasts.
Why does the loop only happen on some pages or for some visitors?
Different rules can apply to different URLs, such as a plugin redirecting only the checkout or a cached redirect on one path. Cookies can also cause loops for logged-in users. Test several URLs in a private window and trace each with curl.
How do I fix a WordPress redirect loop behind a CDN?
Set both WordPress URLs to https:// under Settings > General, and add code to wp-config.php that sets $_SERVER['HTTPS'] to on when X-Forwarded-Proto is https. The better fix is Full (strict) at the CDN.
How can I be alerted if a redirect loop starts?
A synthetic monitor that loads your key pages on a schedule will see the loop. FunnelGuard's redirects check detects loops and sends one alert after a second-region re-check.
Related issues
- OPS-064HTTP not redirected to HTTPSFix guide
- OPS-062HSTS header missingFix guide
- OPS-066Form posts to http endpoint from https pageFix guide
- OPS-070Let's Encrypt renewal broken by redirect or firewallFix guide
- OPS-053SSL certificate expiredFix guide
- OPS-063HSTS too strict on a subdomain without HTTPSFix guide