0

I use cloudflare, and i notice that when i send POST request to php file with parameter ignore_user_abort(1), after some time (~40-50 sec) server return error. And it is normal, because the task in php very heavy, and it takes 10-15mins to execute. But problem is that after error, cloudflare try to repeat request. And i see that the php code starts to execute again and again until restarting php fpm service. I do the same request by ip address, in that case it is execute only one time, i mean it works correctly. It worked with cloudflare before, but there are several days that i faced with this error. I guess it is some option i have to switch off in cloudflare.

1 Answers1

1

you should think about manually aborting the client connection -> this way you can respond ie with a Http status 202 (accepted, but still processing)

look here to close a connection early

wodka
  • 1,320
  • 10
  • 20
  • But why then it is working when i do request without cloudflare? – Fəqan Çələbizadə Jan 20 '19 at 20:11
  • Cloudflare itself has a limit on the request time - it will try afterwards if your host is still up and might retry it. – wodka Jan 20 '19 at 20:20
  • in general it is never a good idea to assume that the connection can be held open for such a long duration. Gracefully abort and indicate that processing is done in the background – wodka Jan 20 '19 at 20:20
  • When you call without cloudflare it just takes the timeout you set up – wodka Jan 20 '19 at 20:21