Web Pages in Redirect Loop Infinitely After Enabling CloudFlare SSL HTTPS Connection

»»»Web Pages in Redirect Loop Infinitely After Enabling CloudFlare SSL HTTPS Connection

If you’re using CloudFlare CDN as the DNS and HTTP proxy, the following redirection error (the exact error messages may be different depending on which web browser is used – Google Chrome, IE, Edge, Mozilla Firefox, Opera etc.) may occur with you activate SSL under “Crypto” to encrypt communication to and from your website.

The page isn’t redirecting properly

An error occurred during a connection to www.domain.com.

  • This problem can sometimes be caused by disabling or refusing to accept cookies.

The page isn't redirecting properly.

The page isn’t working

www.domain.com redirected you too many times.

Try clearing your cookies.

ERR_TOO_MANY_REDIRECTS

The page isn't working.

The error usually happens when the Cloudflare SSL setting, which determines how CloudFlare connects to the origin server for HTTPS requests, is set to the wrong option.

By default, CloudFlare sets the SSL setting to “Flexible”, which allows CloudFlare to provide a secure connection between the visitor and CloudFlare using HTTPS for unsecured websites without SSL certificates that use CloudFlare as proxy. If your website already has SSL enabled with SSL certificate (including self-signed SSL cert) installed, setting the CloudFlare’s SSL option to “Flexible” will cause the redirect loop if the original web server also has a redirection setup to forward HTTP traffic to HTTPS.

When using Cloudflare Flexible SSL, there should be NO SSL certificate installed at the origin web server. Thus, in order to fix the redirection loop when enabling CloudFlare SSL, try one of the following options:

  • If you have SSL certificate, including self-signed SSL certificate, set the CloudFlare SSL option to Full or Full (Strict).

    CloudFlare SSL Crypto

    Full SSL setting allows CloudFlare to connect to origin server via secure HTTPS connection without validation or authentication (allows self-signed SSL certificate), while Full (Strict) forces CloudFlare to connect over HTTPS and verify the SSL certificate validity (not expired and signed by a trusted CA or Cloudflare Origin CA).

  • Remove the redirection set up at the web server that forwards HTTP to HTTPS (e.g. in .htaccess or Apache httpd.conf and etc.).

Normally, one of the above resolutions would resolve the redirection loop issue. If the issue persists, CloudFlare provides further suggestions which may be helpful in resolving the problem:

  • If you are on an Apache web server, ensure that you have Mod_Cloudflare installed.
  • If you use Nginx or Mod_Cloudflare does not automatically resolve the issue, ensure you have our official WordPress plugin installed.

By |2018-11-13T00:38:13+00:00November 13th, 2018|Categories: Cloud Computing|Tags: , |0 Comments

About the Author:

LK is a technology writer for Tech Journey with background of system and network administrator. He has be documenting his experiences in digital and technology world for over 15 years.Connect with LK through Tech Journey on Facebook, Twitter or Google+.