504 Gateway Time-out The server didn't respond in time

Go to your network settings in Cloudflare and turn off HTTP 2 to Origin, and give it another try.

I also was experiencing an intermittent performance issue with multiple sites who are hosted with GoDaddy and changing this HTTP 2 to Origin immediately solved the slowness and 504 timeout errors.

I spent a whole day testing with various sites and without a question it was specifically this HTTP 2 setting that was causing some bottleneck between Cloudflare and the origin. I only tested on sites that are hosted with GoDaddy (USA, France and Singapore) so it could be an issue with GoDaddy.

The issue was most obvious with POST and PUT requests taking as much as 100x - 200x times longer (if not 504 error) with HTTP2 to Origin, and GET requests were anywhere from 10x to 25x higher TTFB latency.

Turning off HTTP 2 to Origin had an immediate improvement, and turning it back on had an immediate crash in performance.