Wordpress wp-admin goes into loop when on cloudflare ssl

From DevOps Notebook
Revision as of 10:47, 2 November 2020 by MilosZ (talk | contribs) (Created page with "If there is no ssl configured on web server but is enabled in cluodflare,wp-admin often goes in to loop with error: <pre> The page isn’t redirecting properly An error occur...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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: 1. Download cert from cloudflare and install it on web server 2. Set ssl to config to "full" in cloudflare 3. Add few config directives into wp-config.php file: <> 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';