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

**URL:** <https://help.nextcloud.com/t/server-replied-413-request-entity-too-large-to-put/154278>\
**Category:** 📦 Appliances (Docker, Snappy, VM, NCP, AIO)\
**Tags:** docker\
**Created:** [January 23, 2023, 7:33pm UTC](https://help.nextcloud.com/t/server-replied-413-request-entity-too-large-to-put/154278 "2023-01-23T19:33:00Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![kenjibailly](https://help.nextcloud.com/letter_avatar/kenjibailly/32/5_5575768a8748004e209b776fc1b2916d.png) [@kenjibailly](https://help.nextcloud.com/u/kenjibailly)\
**Post date:** [January 23, 2023, 7:33pm UTC](https://help.nextcloud.com/t/server-replied-413-request-entity-too-large-to-put/154278/1 "2023-01-23T19:33:00Z")

</div>

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

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

```

OR

```auto
Unable to write

```

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

```auto
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](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](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!

---

<div class="post-metadata">

**Author:** ![gokalex](https://help.nextcloud.com/letter_avatar/gokalex/32/5_5575768a8748004e209b776fc1b2916d.png) [@gokalex](https://help.nextcloud.com/u/gokalex)\
**Post date:** [January 27, 2023, 4:55pm UTC](https://help.nextcloud.com/t/server-replied-413-request-entity-too-large-to-put/154278/2 "2023-01-27T16:55:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kenjibailly](https://help.nextcloud.com/letter_avatar/kenjibailly/32/5_5575768a8748004e209b776fc1b2916d.png) [@kenjibailly](https://help.nextcloud.com/u/kenjibailly)\
**Post date:** [January 29, 2023, 2:07pm UTC](https://help.nextcloud.com/t/server-replied-413-request-entity-too-large-to-put/154278/3 "2023-01-29T14:07:47Z")

</div>

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:

> <https://github.com/nextcloud/desktop/pull/4826>
>
> Currently when Nextcloud runs behind a server with an upload limit, uploading a …large file (e.g. several 100M) will likely fail when \`nextcloud.cfg\` is not manually adjusted on every endpoint to limit \`maxChunkSize\` (assuming an upload limit is usually not set to 1G but more likely 100M or lower).
> 
> This PR implements auto-adjustment of the max upload size when receiving \`HTTP-413\` (request entity too large) or a close connection error after large uploads
> 
> This is achieved with the following strategy:
> 
> \* The config is enhanced with parameter \`failsafeMaxChunkSize\` (default \`100M\`).
> \* When \`HTTP-413\` is received:
> \* If \`requestSize \> failsafeMaxChunkSize\`, the failsafe max size applies and the sync is retried immediately.
> \* Otherwise \`maxChunkSize = requestSize / 2\` and the sync is retried until it succeeds or \`minChunkSize\` is reached (default \`1M\`).
> \* A connection close error is treated like \`HTTP-413\` if \`requestSize \> failsafeMaxChunkSize\`. HTTP usually requires that requests are fully consumed, servers may decide to close the HTTP connection when too much data is sent to prevent this. As connection close is not a specific error, only large uploads are handled by this change.
> 
> While \`failsafeMaxChunkSize\` can be adjusted in \`nextcloud.cfg\` or via env var \`OWNCLOUD\_FAILSAFE\_MAX\_CHUNK\_SIZE\`, it should have a reasonable default so that it isn't required. When set properly it limits the amount of retries needed and enables uploads for the cases where the HTTP connection is closed as response to sending too much data.
> 
> For cases where an upload limit in the web server is greater \`1M\` and a connection close error is only received for uploads \`\>100M\`, the default values allow all uploads to succeed without any additional configuration.
> 
> This should fix most cases reporting errors in this area like #4278 and #925.
> 
> For 2 concurrent uploads (~0.5GB each) and the nginx frontend limited to 100M this looks like this (in an earlier implementation without failsafeMaxChunkSize):
> 
> \`\`\`
> 2022-08-06 22:18:06:368 \[warning nextcloud.sync.credentials.webflow ./src/gui/creds/webflowcredentials.cpp:229 \]:	"Error transferring https://nextcloud/remote.php/dav/uploads/user/2789530175/0000000000000001 - server replied: Request Entity Too Large"
> 2022-08-06 22:18:06:369 \[info nextcloud.sync.networkjob.put ./src/libsync/propagateupload.cpp:87 \]:	PUT of "https://nextcloud/remote.php/dav/uploads/user/2789530175/0000000000000001" FINISHED WITH STATUS "UnknownContentError Server replied \\"413 Request Entity Too Large\\" to \\"PUT https://nextcloud/remote.php/dav/uploads/user/2789530175/0000000000000001\\"" QVariant(int, 413) QVariant(QString, "Request Entity Too Large")
> 2022-08-06 22:18:06:369 \[debug nextcloud.sync.propagator.upload ./src/libsync/propagateupload.cpp:662 \]	\[OCC::PropagateUploadFileCommon::commonErrorHandling \]:	"\<html\>\\r\\n\<head\>\<title\>413 Request Entity Too Large\</title\>\</head\>\\r\\n\<body\>\\r\\n\<center\>\<h1\>413 Request Entity Too Large\</h1\>\</center\>\\r\\n\<hr\>\<center\>nginx/1.22.0\</center\>\\r\\n\</body\>\\r\\n\</html\>\\r\\n"
> 2022-08-06 22:18:06:369 \[info nextcloud.sync.database ./src/common/syncjournaldb.cpp:1798 \]:	Setting blacklist entry for "test.img.gz" 1 "Upload of 316 MB exceeds the max upload size allowed by the server. Reducing max upload size to 158 MB" 1659817086 0 1627988766 "" "" 0
> 
> 2022-08-06 22:18:30:645 \[warning nextcloud.sync.credentials.webflow ./src/gui/creds/webflowcredentials.cpp:229 \]:	"Error transferring https://nextcloud/remote.php/dav/uploads/user/2750000573/0000000000000000 - server replied: Request Entity Too Large"
> 2022-08-06 22:18:30:645 \[info nextcloud.sync.networkjob.put ./src/libsync/propagateupload.cpp:87 \]:	PUT of "https://nextcloud/remote.php/dav/uploads/user/2750000573/0000000000000000" FINISHED WITH STATUS "UnknownContentError Server replied \\"413 Request Entity Too Large\\" to \\"PUT https://nextcloud/remote.php/dav/uploads/user/2750000573/0000000000000000\\"" QVariant(int, 413) QVariant(QString, "Request Entity Too Large")
> 2022-08-06 22:18:30:645 \[debug nextcloud.sync.propagator.upload ./src/libsync/propagateupload.cpp:662 \]	\[OCC::PropagateUploadFileCommon::commonErrorHandling \]:	"\<html\>\\r\\n\<head\>\<title\>413 Request Entity Too Large\</title\>\</head\>\\r\\n\<body\>\\r\\n\<center\>\<h1\>413 Request Entity Too Large\</h1\>\</center\>\\r\\n\<hr\>\<center\>nginx/1.22.0\</center\>\\r\\n\</body\>\\r\\n\</html\>\\r\\n"
> 2022-08-06 22:18:30:646 \[info nextcloud.sync.database ./src/common/syncjournaldb.cpp:1798 \]:	Setting blacklist entry for "Test.ISO" 1 "Upload of 158 MB exceeds the max upload size allowed by the server. Reducing max upload size to 80 MB" 1659817110 0 1418024480 "" "" 0
> 
> 2022-08-06 22:18:31:467 \[warning nextcloud.sync.credentials.webflow ./src/gui/creds/webflowcredentials.cpp:229 \]:	"Error transferring https://nextcloud/remote.php/dav/uploads/user/2789530175/0000000000000002 - server replied: Request Entity Too Large"
> 2022-08-06 22:18:31:467 \[info nextcloud.sync.networkjob.put ./src/libsync/propagateupload.cpp:87 \]:	PUT of "https://nextcloud/remote.php/dav/uploads/user/2789530175/0000000000000002" FINISHED WITH STATUS "UnknownContentError Server replied \\"413 Request Entity Too Large\\" to \\"PUT https://nextcloud/remote.php/dav/uploads/user/2789530175/0000000000000002\\"" QVariant(int, 413) QVariant(QString, "Request Entity Too Large")
> 2022-08-06 22:18:31:467 \[debug nextcloud.sync.propagator.upload ./src/libsync/propagateupload.cpp:662 \]	\[OCC::PropagateUploadFileCommon::commonErrorHandling \]:	"\<html\>\\r\\n\<head\>\<title\>413 Request Entity Too Large\</title\>\</head\>\\r\\n\<body\>\\r\\n\<center\>\<h1\>413 Request Entity Too Large\</h1\>\</center\>\\r\\n\<hr\>\<center\>nginx/1.22.0\</center\>\\r\\n\</body\>\\r\\n\</html\>\\r\\n"
> 2022-08-06 22:18:31:467 \[info nextcloud.sync.database ./src/common/syncjournaldb.cpp:1798 \]:	Setting blacklist entry for "test.img.gz" 1 "Upload of 158 MB exceeds the max upload size allowed by the server. Reducing max upload size to 80 MB" 1659817111 0 1627988766 "" "" 0
> \`\`\`
> 
> After 3 attempts uploads succeed.
> 
> Hope this is accepted. Feedback is welcome.

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

---

<div class="post-metadata">

**Author:** ![Th0r](https://help.nextcloud.com/user_avatar/help.nextcloud.com/th0r/32/46669_2.png) [@Th0r](https://help.nextcloud.com/u/Th0r)\
**Post date:** [March 22, 2023, 8:40am UTC](https://help.nextcloud.com/t/server-replied-413-request-entity-too-large-to-put/154278/4 "2023-03-22T08:40:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Tromm\_Stone](https://help.nextcloud.com/user_avatar/help.nextcloud.com/tromm_stone/32/19767_2.png) [@Tromm\_Stone](https://help.nextcloud.com/u/Tromm_Stone)\
**Post date:** [January 8, 2024, 10:18am UTC](https://help.nextcloud.com/t/server-replied-413-request-entity-too-large-to-put/154278/5 "2024-01-08T10:18:43Z")

</div>

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 ‼ **SSL** ‼ vhost go to the www directory statement under which nextcloud exists. You must place the SSLRengeBufferSize inside and not outside the directory statement!

```auto
<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):

```auto
http {
    ...
    ...
    client_max_body_size 1000M;
    client_body_buffer_size 400M;
    ...

```

- nginx vhostXYZ.conf (did not help either):

```auto
server {
    ...
    ...
    client_max_body_size 1000M;
    ...
    location / {
        ...
        client_max_body_size 1000M;
        ...

```

- php.ini (was already set correctly and therefore did not help):

```auto
...
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 🙂

---

<div class="post-metadata">

**Author:** ![Norbert\_Pankotai](https://help.nextcloud.com/user_avatar/help.nextcloud.com/norbert_pankotai/32/60065_2.png) [@Norbert\_Pankotai](https://help.nextcloud.com/u/Norbert_Pankotai)\
**Post date:** [March 23, 2024, 6:44pm UTC](https://help.nextcloud.com/t/server-replied-413-request-entity-too-large-to-put/154278/6 "2024-03-23T18:44:23Z")

</div>

APACHE\_BODY\_LIMIT = 0

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

---

<div class="post-metadata">

**Author:** ![Josepth\_Shi](https://help.nextcloud.com/user_avatar/help.nextcloud.com/josepth_shi/32/52160_2.png) [@Josepth\_Shi](https://help.nextcloud.com/u/Josepth_Shi)\
**Post date:** [May 15, 2024, 2:02am UTC](https://help.nextcloud.com/t/server-replied-413-request-entity-too-large-to-put/154278/7 "2024-05-15T02:02:35Z")

</div>

Thanks ! This fixed my problem!

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

```

---

<div class="post-metadata">

**Author:** ![mattmill](https://help.nextcloud.com/letter_avatar/mattmill/32/5_5575768a8748004e209b776fc1b2916d.png) [@mattmill](https://help.nextcloud.com/u/mattmill)\
**Post date:** [August 17, 2024, 3:29pm UTC](https://help.nextcloud.com/t/server-replied-413-request-entity-too-large-to-put/154278/8 "2024-08-17T15:29:58Z")

</div>

Adding this to my docker environment variables fixed it for me!

---

<div class="post-metadata">

**Author:** ![JF\_1](https://help.nextcloud.com/user_avatar/help.nextcloud.com/jf_1/32/67999_2.png) [@JF\_1](https://help.nextcloud.com/u/JF_1)\
**Post date:** [January 8, 2025, 5:34am UTC](https://help.nextcloud.com/t/server-replied-413-request-entity-too-large-to-put/154278/9 "2025-01-08T05:34:12Z")

</div>

That did the trick!

PHP\_UPLOAD\_LIMIT was already set, but by itself it doesn’t work on the default docker image.

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [May 22, 2025, 5:50am UTC](https://help.nextcloud.com/t/server-replied-413-request-entity-too-large-to-put/154278/10 "2025-05-22T05:50:36Z")

</div>


