We have a web application that is using our RESTful API behind Cloudflare DNS. In some cases, a specific endpoint returns 524 and in case we try sending same request subsequently, it works smoothly.
The endpoint doesn’t connect to any database or a remote service so it’s unlikely that it takes more than 100 seconds for the webserver to respond to the request so we installed a debugger tool that keeps tracks of the XHR requests on the client-side. What we found is that Cloudflare returns 524 even though the request duration is just 530ms but when we look at the docs, the status code indicates that the origin server was unable to respond within 100 seconds.
Ray Id: 5e0f85546b9eda6a
Response Content: https://jsfiddle.net/6epwdt17/
cache-control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
content-type: text/html; charset=utf-8
date: mon, 12 oct 2020 08:41:16 gmt
expires: thu, 01 jan 1970 00:00:01 gmt
Can someone help us understand the exact cause of the problem?