These lines in wp-config.php worked for me to have no mixed content anymore. I found it here.
The example wordpress domain is wordpress.domain.tld
/* Add any custom values between this line and the "stop editing" line. */
define('.COOKIE_DOMAIN.', 'wordpress.domain.tld');
define('.SITECOOKIEPATH.', '.');
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$list = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']);
$_SERVER['REMOTE_ADDR'] = $list[0];
}
define('WP_HOME', 'https://wordpress.domain.tld');
define('WP_SITEURL', 'https://wordpress.domain.tld');
$_SERVER['HTTP_HOST'] = 'wordpress.domain.tld';
$_SERVER['REMOTE_ADDR'] = 'https://wordpress.domain.tld';
$_SERVER['SERVER_ADDR'] = 'wordpress.domain.tld';
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
$_SERVER['HTTPS']='on';
/* That's all, stop editing! Happy publishing. */
I requested a letsencrypt cert for the virtualhost but I think it’s not needed.
BTW, if I disable the letsencrypt cert for the virtualhost, it’s still there, even after reboot. How to revert to the self-signed cert? @stephdl