If you’ve configured your website to use Cloudflare and to take advantage of the free flexible SSL certificate that the service provides, you might find that your WordPress installation doesn’t work correctly and that you are presented with a redirect loop error.
This is due to the flexible SSL setting on Cloudflare. Essentially, enabling ‘Flexible’ mode means that when SSL requests for your website reach Cloudflare, Cloudflare will attempt to fetch your website over plain HTTP. If you website is configured to use HTTPS URLs, an infinite loop occurs.
The quick resolution for this would be to change the SSL option in Cloudflare from Flexible to Full or Full (strict), however this requires that you have a valid SSL certificate on your origin server. Many users will configure their website to run through Cloudflare because they have no certificate installed on their origin server, and so a solution is needed.
If you don’t have a certificate on your origin server, then you can install a WordPress plugin that will resolve the redirect issue.
The Cloudflare Flexible SSL plugin examines the traffic and request headers coming to your WordPress site. If the plugin detects that the traffic is coming from CloudFlare, and that the request is over HTTPS, then SSL is enabled for WordPress.
Enabling the plugin via the WordPress admin may not be possible if you are seeing the redirect loop error if you try and access any page on your WordPress website. Therefore it is worth taking a look at how to enable plugins via the database, like this post..
Alternatively, you could temporarily disable the Flexible SSL option within Cloudflare. However please note that for Cloudflare accounts that are on the ‘Free’ plan, changes to the SSL option could take up to 24 hours.