Cloudflare 524 error with AJAX

I am making an ajax request to the site for Cloudflare. After 100 seconds, I get 524. However, I cannot process this 524 in my Javascript, because the error page is served directly by Cloudflare and does not contain the required Access-Control-Allow-Origin headers.

I want to repeat the request if I receive 524.

+7
cors timeout cloudflare
source share
1 answer

If you know that the CloudFlare edge will wait for an HTTP response from the server for exactly 100 seconds, you can simply set a timeout of 100 seconds for ajax request. And retry the request after a timeout.

Alternatively, you can move this request to a subdomain that is not under the cloud flash proxy.


Another idea is to use a reverse proxy and add CORS headers. In apache which will

<LocationMatch "/ajax-request-used-in-js"> ProxyPass http://example.com/ajax Header add "Access-Control-Allow-Origin" "*" </LocationMatch> 
+2
source share

All Articles