I am getting 522 errors - when Cloudflare is turned on. If I turn it off, the website works fine!
Had the same problem yesterday, but suddenly the error was gone again.
I have the Cloudflare caching turned on, and the flexible SSL. When setting “Proxy status” to DNS only Cloudflare dashboard - my sites are working fine.
I have this error on multiple websites, that are hosted on different webservers.