Server replied "413 Request Entity Too Large" to PUT

I’ve done everything I found, but still I’m getting this error in the windows client.

Server replied "413 Request Entity Too Large" to PUT ...

OR

Unable to write

But then I find these kind of errors in the config/log/nginx/error.log

client intended to send too large body: 748952021 bytes ...

When I drag and drop a file in the browser (3.3GB) it uploads just fine. It seems only to have trouble with the auto syncing using the windows nextcloud client.

I’m using the local ip address, which rules out the reverse proxy.

I have followed this:
https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/big_file_upload_configuration.html

Changed these values in /etc/php8/php.ini

  • memory_limit = 1024M
  • post_max_size=1024G
  • upload_max_filesize=1024G
  • max_execution_time=3600
  • max_input_time = 3600

I have checked .htaccess and .user.ini for similar variables, but didn’t find any.
Whenever the container gets an update, these values reset, which is quite annoying. Just mentioning this for testing purposes.

I’m using the latest image and fresh install: https://docs.linuxserver.io/images/docker-nextcloud
I have tried to add these env variables in my docker yaml:
- PHP_UPLOAD_LIMIT=1024G
- PHP_MEMORY_LIMIT=1024M

I changed this value in /config/nginx/nginx.conf
(I also tried giving it 0)

  • client_max_body_size 1024G;

Also this command didn’t work inside my container:
sudo -u www-data php occ config:app:set files max_chunk_size --value 20971520

Now note, when I go into my cloud using the browser and upload a file it had trouble with (above error), it uploads fine and is there in the cloud (3.3GB file). So it seems like it’s giving errors that I can’t figure out.

I’ve been trying to get this fixed, but unfortunately I don’t know what else to try at this point.
Help would be appreciated!

I have the same problem, i can upload large files (over 1gb) from the browser but anything over 300-500MB fails from the client.

Client version: 3.6.6 macOS 10.15.7
Server version: Nextcloud 24.0.6

So basically I kind of fixed my problem, although I’m getting other errors now.
I think my problem has to do with this issue that is on Github:

The fix I did was to add this in nextcloud.cfg under [General]:
maxChunkSize=500000000

nextcloud.cfg is located in:
C:\Users\USERNAME\AppData\Roaming\Nextcloud
or easier:
%appdata%/nextcloud

2 Likes

Hi All,

Anyone managed to sort this problem out?
I’m having the same issue and tried everything that had to be add/changed on config.php, php.ini

My solution:

Within every effected vhost apache conf (if you have apache behind the nginx reverse proxy and your nextcloud instances connect via https (ssl)). And within the :bangbang: SSL :bangbang: vhost go to the www directory statement under which nextcloud exists. You must place the SSLRengeBufferSize inside and not outside the directory statement!

<directory /your/www/directory/>
    ...

    ## Nextcloud behind nginx ssl reverse proxy no more upload possible (Err 413)
    ## Below Setting is 20MB but you can deal with other sizes
    SSLRenegBufferSize 20971520
    ...
</directory>

So, in my case, there is no need to change the client configs. I din’t want this, because on the webinterface of NextCloud, I had the same upload Problem and I needed another solution.

Previously I had also tried everything that is written in countless forums. But of course I left the values that I set here (below) in the configs as they now have an effect for the future.

  • nginx.conf (had not helped):
http {
    ...
    ...
    client_max_body_size 1000M;
    client_body_buffer_size 400M;
    ...
  • nginx vhostXYZ.conf (did not help either):
server {
    ...
    ...
    client_max_body_size 1000M;
    ...
    location / {
        ...
        client_max_body_size 1000M;
        ...
  • php.ini (was already set correctly and therefore did not help):
...
post_max_size = 1000M
upload_max_filesize = 1000M
...

- NextCloud config.php (did not help either):
...
...
'post_max_size' => '1000M',
...
...

I didn’t change anything on Apache before, which was previously running without the nginx reverse proxy, except for the new ports (8080+8443).

About the setup: I have the Nginx reverse proxy running on the same server as Apache. The proxy therefore forwards to a local URL (80+443 are forwarded to 8080+8443). The server has enough power for this. The goal was simply to speed up the wordpress blogs, which I more than SUCCEEDED with the new setup :slight_smile:

APACHE_BODY_LIMIT = 0

This solved the problem for me
In Docker the env is entered

Thanks ! This fixed my problem!

NextCloud Client  :   3.13.0stable-Win64 (build 20240423) 
NextCloud Server : 27.1.9.1