I had this issue with an AWS Lightsail instance running behind Cloudflare with SSL. The browser was talking HTTPS to Cloudflare which was talking HTTP to the backend.
To fix, I had to un-proxy from Cloudflare, enable LetsEncrypt SSL on the instance, update wp-config.php
to use https in WP_SITEURL
and WP_HOME
then set ‘Full SSL’ when proxying through Cloudflare.
Now both the server and the browser concur about HTTPS being used.