That’s definitely from the server. Server logs should provide more information on this error. Your hosting provider should easily figure this one out.
Ah, I re-read your 524 situation. That’s clearly due to the process taking longer than Cloudflare will wait. One workaround is to put your server’s IP address in a local Hosts file on your computer so you are directly connected to the server for such admin tasks, thus bypassing the Cloudflare timeout.