Woocommerce ERR_TOO_MANY_REDIRECTS on Checkout with Force SSL

I have a few websites running Woocommerce with a shared SSL certificate from CloudFlare. I haven’t had any issues until recently. The website would work fine with HTTPS until it reached checkout. Then I would get ERR_TOO_MANY_REDIRECTS at the checkout page. After trying multiple Force SSL options and making changes to the .htaccess file and still not having any success; I decided it was time to do some research.

I came across this solution on the Woothemes documentation:


Websites behind load balancers or reverse proxies

WooCommerce uses is_ssl() WordPress function to verify if your website is over SSL or not.

is_ssl() checks if HTTPS or on Port 443. And this won’t work for website behind some load balancers, especially Network Solutions hosted websites.

Websites behind load balancers or reverse proxies that support HTTP_X_FORWARDED_PROTO can be fixed by adding the following code to the wp-config.php file, above the require_once call:

if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && 'https' == $_SERVER['HTTP_X_FORWARDED_PROTO'] ) {
    $_SERVER['HTTPS'] = 'on';
If you use CloudFlare, you’ll probably need to configure it.
This worked perfectly and had all my sites back up and running!
Recommended Posts
Showing 5 comments
  • Joe Fletcher

    Thanks, Chris! I just copied and pasted that into my wp-config.php and it fixed it immediately. I’m trying out CloudFlare as a quick HTTPS solution for a personal blog and got the ERR_TOO_MANY_REDIRECTS as soon as I changed my WordPress URL in settings to https.

  • Steve P


  • Michael

    This also fixed my issue. Thank you!

  • Tom

    Thanks, it’s very cool when you find a simple fix.. I’ve been on this for two hours and no joy : (

    Too many bloggers, too little actionable advice..

    Thanks again for a plain speaking workable solution!


  • Kevin

    This also helped as well. Thank you. Site was hosted on Dreamhost, and tied in with a CDN.

Leave a Comment