522 basically means that Cloudflare cannot reach your server at all.
Can you access you webserver via it’s ip address on port 443, or when the A record is set to ?
What kind of certificate is installed on the origin? If it is self signed or invalid due to expiration for example, change your SSL settings to “Full”.