Make sure that you define the WP_SITEURL and WP_HOME at wp-config.php
define('WP_HOME','https://yourdomain.com');
define('WP_SITEURL','https://yourdomain.com');
And add this condition to check if the https at wp-config.php
if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && 'https' == $_SERVER['HTTP_X_FORWARDED_PROTO'] ) {
$_SERVER['HTTPS'] = 'on';
}