Error "Bad Request: Expected File Size..."

Hey,

currently I setup my own Nextcloud (self-hosted). But when uploading large files > 500 MB, I receive this error:

BadRequest
Expected filesize of 2708731595 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 0 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.

I’m aware there are many other people dealing with the same issue, but yet I couldn’t find a solution in those topics.

Occourance:

  1. I start a sync using Dav or Nextcloud Desktop client. (no issues on web upload)
  2. A moment after the upload starts, the error message appears in the Nextcloud logs. The upload is at only a few MBs at this point.

My setup:
Debian 12 (virtualized)
Nextcloud 29.0.1
PHP 8.2.18 (no nginx, also no fpm folders)
MariaDB

What I tried already:
/etc/apache2/apache2.conf

LimitXMLRequestBody 0

/etc/apache2/sites-available/nextcloud.conf (automatically copied to sites-enabled after restart)

FcgidProcessLifeTime 8200 FcgidIOTimeout 8200 FcgidConnectTimeout 3600 FcgidMaxRequestLen 1000000000 RequestReadTimeout handshake=0 header=600,MinRate=500 body=600,MinRate=500 LimitXMLRequestBody 0

/var/www/nextcloud/config/config.php

‘tempdirectory’ => ‘/var/www/nextcloud/data/tmp’,

/etc/php/8.2/cli/php.ini
and
/etc/php/8.2/apache2/php.ini

changing the following settings to higher values:
upload_max_filesize = 4G
max_execution_time = 3600
max_input_time = 3600

upload_tmp_dir = “/var/www/nextcloud/data/tmp”
sys_temp_dir = “/var/www/nextcloud/data/tmp”

enabling and disabling httpd2

Does anyone have further ideas? Or did I do a mistake in any step?

Okay, I solved the mystery.
I added one line to the wrong file and wrong line.

Solution

Simply add the line “LimitRequestBody 0” to
“/etc/apache2/sites-available/nextcloud.conf”.

Please mind that this is the config name and file I use. Edit the path accordingly. To check which file you use, you can check your active configs in
“/etc/apache2/sites-enabled/”.

Place to insert the line:

image

After this, restart Apache:
“systemctl restart apache2”

1 Like

For those that end up in here in the future: Uploading big files > 512MB — Nextcloud latest Administration Manual latest documentation