I got this issue too. Make sure that your site doesn’t display errors or warnings. Because if they are written before headers, that fails. You can add this in your wp-config.php file to solve this issue.
ini_set(‘log_errors’,’On’);
ini_set(‘display_errors’,’Off’);
ini_set(‘error_reporting’, E_ALL );
define(‘WP_DEBUG’, false);
define(‘WP_DEBUG_LOG’, true);
define(‘WP_DEBUG_DISPLAY’, false);