[RESOLVED] Partial uploablocked on cloudflare?


We have a rest API for uploading a binary file. Our API should also work if only a partial body was received (for example, like in a disconnection in the middle of the upload.

Without cloudflare, we are able to test this behaviour by declaring the content length header to be 100 bytes, but sending only 20 bytes in the body. Eventually the request times out, and we can see the 20 bytes in the server.

It appears that when behind cloudflare, the server doesn’t get the request at all. As if cloudflare waits for the entire body before passing it down to the real server.

Is there a possibility to disable this behaviour? If not, can I prevent this behaviour only from this API using page rules (I tried but it didn’t work)?



UPDATE: we resolved the issue by not sending the entire file as streaming and sending in chunks instead. For example, in the use case above, sending 5 requests of 20 bytes, instead of sending 100 and expecting it to save the first twenty. Not a large change eventually. Cloudflare clearly doesn’t support this and it makes sense. It can’t make sure the request is legit without getting the entire request. So it doesn’t make sense to expect to get a partial request in the backend.

This topic was automatically closed after 30 days. New replies are no longer allowed.