Nextcloud behind Cloudflare (timeout and chunk size)

Hi!

After reading a lot I have seen that installing Nextcloud and accessing it through Cloudflare can have small drawbacks.

The first is that the chunk size cannot be greater than 100MB, which is the maximum size that Cloudflare allows to upload files (https://support.cloudflare.com/hc/en-us/articles/200172516-Understanding-Cloudflare -s-CDN)
In other words, the file you upload will be divided into 100MB sub-files that will later be rebuilt.
This is not a problem for me.

The second problem I see is that cloudflare has a 100 second timeout limit (https://support.cloudflare.com/hc/en-us/articles/115003011431-Troubleshooting-Cloudflare-5XX-errors)
That causes me problems when I upload large files (greater than 8GB) and has to do with the time it takes to rebuild the file after the upload is finished.

During the state of “processing files” the system takes all the 100MB files located in the uploads folder and copies them rebuilt to the files folder.
If this process takes more than 100s it returns a timeout error (caused by cloudflare having no response during this time).
Is it possible to fix this?
Is it possible to send a “keep alive” message while the rebuilding process lasts?

Thank you!


Nextloud 20.0.2 / VM: Ubuntu Server 20.04 / 2 cores / 2 GB RAM
PHP: 7.4.3 / Memory Limit: 1 GB / Max Execution Time: 3600
mysql / 8.0.22
Nextcloud VM behind NGINX Reverse Proxy

Sorry. But it think it makes no really sense to use Nextcloud behind Cloudflare if you want use it as CDN (Content Delivery Network). Why are you using Cloudflare?

@devnull
Cache and performance options are disabled in CF for the domain where NextCloud is. I use it mainly for the security options (DDOS, WAF, etc).

Ok. Than it makes perhaps sense.

Have you tested Flow Upload. Perhaps it can solve this problem.

@devnull
That is why I wanted to know if there is any option to keep the connection alive while the files are processed so as not to exhaust the 100s that CF has of timeout.
I will test the app Flow Upload
Thanks! :grinning:

1 Like

@devnull
The truth is that with the Flow Upload app I have not experienced timeout problems, but it took me much much longer to upload a 10GB file. I think it is because the chunk with this app is put in 1MB files and rebuilding them has been much faster.
Is there no solution without using external apps?
Thank you!

1 Like

Same here. Running NC on my NAS and upload a daily backup file from my android client (auto-upload from watched folder). The file (~2.5GB) gets uploaded completly but the cliend tells me upload error. This leads to a upload restart and a ‘file exist’ conflict.

Is there a solution for a keep-alive-ping or increasing the timeout?

Hi, this thread is for NC instances that are behind Cloudflare. Depending on how you have it you will have to edit the Apache / Nginx / PHP configuration files to achieve that.