Our thinking


Fix WordPress over HTTPS with CloudFlare SSL

I’ve had an issue with my site that prevented it from working fully over https – and as it turns out, it’s due to CloudFlare’s reverse proxy and the way it deals with http and https requests.

I found the answer in a StackExchange thread, and it’s an easy fix.

In your wp-config, before the line towards the bottom that is a require_once for wp-settings.php, you need to add a line:

if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') $_SERVER['HTTPS']='on';

There’s a bit more detail in this StackOverflow thread however it essentially comes down to the way that CloudFlare acts as a reverse proxy for my WordPress site and while the browser is requesting https from CloudFlare, CloudFlare makes the request back to my web host over http instead.

Leave a Reply

Your email address will not be published. Required fields are marked *