I hope I could fix the bug. At least it was not show up anymore. I changed the hosts:
sudo nano /etc/hosts
Now I could finally see what happens “behind Cloudflare”. There were still some links on the page without ssl. So the page switched from time to time between secure and insecure.
And the second issue was that under Safari there was a
nsposixerrordomain 100 error where the page was completely gone.
Stackoverflow says in this case to disable http/2 in the load balancer of AWS. And that helped. Don’t know what it was from both, but it seems to be fixed.
I hope that the error does not come back. Cloudflaire should analyze the error more precisely. Only outputting 520 is not enough.