Large file upload fails via shared folder link but succeeds via normal folder view

Nextcloud version: 13.0.5
Operating system and version: Ubuntu 16.04 LTS
Apache version: 2.4.18
PHP version: v7.0.30-0ubuntu0.16.04.1

Large file uploads to a shared link folder (e.g. 18 GB or 25 GB) transfer only a ~15 GB partial file and fail to complete. Logs always show an error like Sabre\DAV\Exception\BadRequest: expected filesize 19283753405 got 14946101760.

This happens only on shared link version of the folders, not on the “normal” view of the folder from the owning user. When uploading the same file via the normal view, the upload succeeds.

The transfer stops at the same ~15 GB partial file regardless if I upload from the same LAN as the server or over a slower WAN connection. That’s a few minute upload vs. a multi hour upload. Doesn’t matter, same result, leading me to believe this cannot be a time-related problem. The partial file varies in size +/- 1GB, but hovers around 14.5-15 GB.

Things I’ve tried.
• Everything in the documentation page about large file uploads:
•Set ‘filelocking.enabled’ => false in the config.php. Resulted in the file continuing to try uploading, creating new .part files uploading the same data over and over again. No error ever shows up to the user in the Web GUI. No locking error message ever shows up in the logs.
• Set ‘tempdirectory’ in config.php to something with more space.
• Apache fixes
○ LimitRequestBody directive - It defaults to 0, is not set anywhere that I can see, and only goes to a max of 2GB anyway… but my uploads are successfully transferring partial files of 15GB already.
○ SSLRenegBufferSize directive - This directive sets the size of buffer for data when SSL renegotiation is occurring. The characteristics I’m seeing with my upload problem (consistent ~15GB size at failure) is not consistent with the kind of problem I’d expect to be created by this directive.
• Tried going around my proxy (HA Proxy), no difference
• Set the upload size in the admin console, which appeared to change a bunch of PHP config settings.

Steps to replicate it:

  1. Create a new folder
  2. Share the folder via link and set it to upload only
  3. Go to the shared link
  4. Upload a >18GB large file and wait for a failure icon to appear next to the file name.

config.php file:

$CONFIG = array (
  'instanceid' => '',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    0 => '',
    1 => '',
  'trusted_proxies' =>
  array (
    0 => '',
  'forwarded_for_headers' =>
  array (
  'datadirectory' => '/nc-data',
  'overwrite.cli.url' => '',
  'htaccess.RewriteBase' => '/',
  'dbtype' => 'mysql',
  'version' => '',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextclouduser',
  'dbpassword' => '',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => 'cloud',
  'mail_domain' => '',
  'mail_smtphost' => '',
  'mail_smtpport' => '25',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 3

Running into this same problem. Did you ever find a cure for it?

Had a similar problem. When I was logged in to normal view mode, everything worked great, but when I tryed to upload to shared folder link I had a problem similar to yours. Only solution that worked for me was theese added configuration lines to .htaccess file located in nextcloud directory

Header unset Upgrade
LimitRequestBody 26843545600
SSLRenergBufferSize 262144

In LimitRequestBody you need to specify your size limit in bytes.