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 d...

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.

Keep This Useful

Spotted something outdated or unclear?

If a step has changed, a screenshot no longer matches, or something here just does not work the way it should, get in touch and we will take a look.