Wordpress wp-admin goes into loop when on cloudflare ssl
From DevOps Notebook
If there is no ssl configured on web server but is enabled in cluodflare,wp-admin often goes in to loop with error:
The page isn’t redirecting properly An error occurred during a connection to quality-nomads.com. This problem can sometimes be caused by disabling or refusing to accept cookies.
Solution is:
- Download cert from cloudflare and install it on web server
- Set ssl to config to "full" in cloudflare
- Add few config directives into wp-config.php file:
<syntaxhighlight lang="php"> define('FORCE_SSL_ADMIN', true); // in some setups HTTP_X_FORWARDED_PROTO might contain // a comma-separated list e.g. http,https // so check for https existence if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
$_SERVER['HTTPS']='on';
</syntaxhighlight