SSL and HTTPS and WooCommerce
Websites behind load balancers or reverse proxies
WooCommerce uses the is_ssl()
WordPress function to verify if your website using SSL or not.
is_ssl()
checks if the connection is via HTTPS or on Port 443. However, this won’t work for websites behind load balancers, especially websites hosted at Network Solutions. For details, read WordPress is_ssl() function reference notes.
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:
if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && 'https' == $_SERVER['HTTP_X_FORWARDED_PROTO'] ) {
$_SERVER['HTTPS'] = 'on';
}
Note: If you use CloudFlare, you need to configure it. Check their documentation.
Last updated: August 21, 2024