Large public share uploads fail after 30 seconds

Nextcloud version (eg, 20.0.5): 26.0.2
Operating system and version (eg, Ubuntu 20.04): Ubuntu 22.04.2 LTS
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.57
PHP version (eg, 7.4): 8.1

The issue you are facing:

I have just discovered that if you create a public share allowing people to upload, then should an upload take more than 30 seconds, it will fail. At first, it will restart the upload, then it will just hang.

This issue does NOT occur if uploading via a logged-in user. This only appears to occur when using a shared URL created for a share.

Is this the first time you’ve seen this error? Yes, but never had this use case before so might have always been present.

Steps to replicate it:

  1. Create a share within NC. Allow the share to be an upload / drop box
  2. Open a new browser tab ensuring you’re not logged into NC (private window will do), go to the share URL.
  3. Attempt to upload a file large enough so that it would take more than 30 seconds for the upload to complete.

The output of your Nextcloud log in Admin > Logging:

Note: I think this is the result of the error, not the cause

[no app in context] Error: Sabre\DAV\Exception\BadRequest: Expected filesize of 3647472199 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. at <<closure>>

0. /var/www/html/share/apps/dav/lib/Connector/Sabre/Directory.php line 149
1. /var/www/html/share/3rdparty/sabre/dav/lib/DAV/Server.php line 1098
   OCA\DAV\Connector\Sabre\Directory->createFile("*** sensitive parameters replaced ***")
2. /var/www/html/share/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 504
   Sabre\DAV\Server->createFile("*** sensitive parameters replaced ***")
3. /var/www/html/share/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
4. /var/www/html/share/3rdparty/sabre/dav/lib/DAV/Server.php line 472
5. /var/www/html/share/3rdparty/sabre/dav/lib/DAV/Server.php line 253
6. /var/www/html/share/3rdparty/sabre/dav/lib/DAV/Server.php line 321
7. /var/www/html/share/apps/dav/appinfo/v1/publicwebdav.php line 123
8. /var/www/html/share/public.php line 81
   require_once("/var/www/html/s ... p")

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'instanceid' => 'xxxxxxxx',
  'passwordsalt' => 'xxxxxxxxxx',
  'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxx',
  'trusted_domains' =>
  array (
    0 => 'xxxxxxxxxxxx',
  'datadirectory' => '/var/www/nextcloud-data',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => 'https://xxxxx/share',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'xxx',
  'dbpassword' => 'xxx',
  'installed' => true,

The output of your Apache/nginx/system log in /var/log/____:
nothing at the time of error

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.
nothing at the time of error

I don’t know where to look. At first, I thought a PHP error, but it seems strange that it only occurs when not logged in.

What is consistent however is that it’s always 30 seconds. Regardless of the file size, client OS or browser used (I’ve tried with Firefox, Chrome and Edge).

This bug is a bit of an issue as I need to have a file drop service running for large files without the need to create individual accounts for everyone.