As explained here Error 502 or 504 · Cloudflare Support docs Cloudflare returns a Cloudflare-branded HTTP 502 or 504 error when your origin web server responds with a standard HTTP 502 bad gateway or 504 gateway timeout error. You must contact your hosting provider to resolve this.