Cloudflare HTTP POST 524 Timeout with node.js + express

I am having problems using HTTP POST when enabling cloudflare. He continues to return 524 timeouts.

Failed to load resource: the server responded with a status of 524 (Origin Time-out) 

But when I turned off cloudflare, the HTTP POST is working fine.

Any idea what might trigger this?

UPDATE

I am using AJAX POST, does this have anything to do with ajax?

Thanks.

+5
source share
2 answers

Common Causes of CloudFlare 524 Error .

Support should provide more detailed troubleshooting.

0
source

The netstat console utility shows that some CloudFlare connections are in CLOSE_WAIT state. Indicating that the server is just sitting without properly closing connections. Looking at the TCP traffic of my web server with Message Analyzer, I found several connections that were established and an HTTP request was sent, but which was never processed by my server.

So, we get the answer: the number of simultaneously established connections exceeds the number of available Accept () calls. So the TCP stack connects and waits while the application processes this connection. Depending on the situation, this can never happen, so the client side simply disconnects this connection after a timeout of 30 seconds without receiving a response.

To fix this, you must increase the number of possible tricks . This parameter can be called "Maximum number of simultaneous connections" or something similar. Check your web server documentation \ contact support to find out.

In addition, as an experiment, you can make the server respond to the โ€œConnection: closeโ€ header for each request. This can prevent you from reaching the restrictions on active connections, because CloudFlare has been keeping them for too long.

In addition, the more concurrent requests you make, the more likely you are to get into trouble. You can try setting a small timeout on the server side for downtime.

PS: Illustration of CloudFlare connection number after one client has loaded the page: ( http://i.imgur.com/IgwGLCf.png )

0
source

Source: https://habr.com/ru/post/1208168/


All Articles