Cloudflare returns 524 but the request duration is 530ms

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
URL: https://app.rakam.io/api/task/status
Response Content: https://jsfiddle.net/6epwdt17/
Response Headers:
cache-control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
cf-ray: 5e0f85546b9eda6a-lis
cf-request-id: 05bd91a8be0000da6aec9e5200000001
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
server: cloudflare
x-firefox-spdy: h2
x-frame-options: sameorigin

Can someone help us understand the exact cause of the problem?

Sorry for the issues, @emrekabakci and +1 on your troubleshooting. If you pause cloudflare on the site, do you get the same results?

Hey @cloonan, the issue occurs rarely but we did not get any report before we integrate Cloudflare. Also, our monitoring tool and Nginx logs don’t have any info about these 524 requests.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.