I have a XML Sitemap Generator that continues to receive 504 / 520 Cloudflare errors from the Gateway with my identification ID.
(HTTP) 504 Gateway Timeout server error response code indicates that the server did not get a response in time from the upstream server that it needed in order to complete the request. .Apparently the problem is a handshake that is not occurring within a Cloudflare 100 second timeframe. Is there a way that Cloudflare can be set to stop this from occurring.
I am a programming novice and need some suggestions.
If it’s running at your origin host/server, it might indicate your server needs more resources, or more power, even more time as the error states, to generate it successfully and completly in one batch file with all the URLs (up to 50k items as I remember per XML sitemap file or if more than that it should be split by multiple sitemap files, at least for Google).
I might suggest you to temporary enable the “Pause Cloudflare for this site” option from the Overview tab of the Cloudflare dashboard.
Run the process, after finish, un-pause it.
Other workardoun to try out is by temporary switching the DNS records for your domain name from proxied to (DNS-only).
Nevertheless, if your PHP settings at your origin server has value of 300 or more, even if you got the error “504 timeout” from Cloudflare, I believe the PHP process still works and does his job in the background until it hits that origin value set for timeout despite the error being shown.
you could try to increase the execution timeout in PHP just in case …