I moved the account to another server and the problem didn't occur on the other server. The main difference (as far as I can tell) between these two servers is that the server with the problem was installed with a self-signed certificate.
The other server is newer and a self signed certificate has never been installed there. A couple of months ago I installed a Letsencrypt on that server. (where the error occurs)
I immediately installed a Letsencrypt certificate on the newer server where everything works fine. Could it be there are somehow still older certificates on the older server?