Sunday, November 17, 2019

HTTP_X_FORWARDED_PROTO fix for WordPress

Websites behind load balancers or reverse proxies that support HTTP_X_FORWARDED_PROTO can be fixed by adding the following code to the wp-config.php file, above the require_once call:

/* Fixing Wordpress & WooCommerce SSL issues */
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
    $_SERVER['HTTPS'] = 'on';
}

No comments:

Post a Comment