tracker icon indicating copy to clipboard operation
tracker copied to clipboard

CouchDB - 413 - Request Entity Too Large

Open JedMeister opened this issue 7 years ago • 8 comments

A CouchDB appliance user has reported that they were getting 413 - Request Entity Too Large errors when interacting with their CouchDB server. After a little trial and error, turns out it was the Nginx default http request body limit of 1MB. That can be adjusted fairly easily. E.g. as noted here.

I'm not sure what the best default setting is, but IMO 1MB is probably way too small.

JedMeister avatar Aug 29 '18 08:08 JedMeister

FWIW, the user has noted that they:

added the line client_max_body_size 20M; in nginx.conf

and that resolved their issue. IMO 20MB seems like a reasonable default. Any input from others would be welcome though.

JedMeister avatar Aug 29 '18 22:08 JedMeister

Well I'm not too sure if 20MB is ideal, but going on the premise of 20MB being better than 1MB. I'll bump it for 16.1 and if we have more issues later we can deal with that then.

OnGle avatar Feb 10 '21 01:02 OnGle

Just grabbed this image (17.1-1) and the changes above don't appear to be in the config? @JedMeister

douglasg14b avatar Jun 25 '23 04:06 douglasg14b

Argh! You're right @douglasg14b! Thanks for bringing it to my attention.

Whilst it was added (hence the issue being closed). it was removed for some reason in v17.0!? There is no note of why, so I assume that that that was a mistake. Reopening and pinning to v18.0

JedMeister avatar Jun 27 '23 04:06 JedMeister

PS @douglasg14b - on the off chance that it's not completely obvious to you, to fix it locally, edit the /etc/nginx/sites-available/couchdb file. Within the server{ ... } block (I suggest under the index line - but it can be anywhere except within either of the location{ ... } sub-blocks), add the line:

    client_max_body_size 20M;

You'll need to restart Nginx (systemctl restart nginx) for it to take effect.

JedMeister avatar Jun 27 '23 04:06 JedMeister

Haha yeah, I sorted it out from the linked commit 😄

Thanks for being responsive!

douglasg14b avatar Jun 27 '23 05:06 douglasg14b

Hello, I'm trying to save data in a CouchDB document using python. I've adjusted the "max_document_size" setting to 1,073,741,824 bytes in both the local.ini and default.ini files. In my CouchDB database, I have created a database in which i currently have only one document. However, when the database size reaches 0.5MB, I encounter an error: An error occurred: (413, ('document_too_large', 'document_name')). Can you please help me resolve this error?

S-a-c-h-i-n-K-u-m-a-r avatar Oct 15 '23 07:10 S-a-c-h-i-n-K-u-m-a-r

Hi @S-a-c-h-i-n-K-u-m-a-r - have you also added the Nginx config change above? I.e.: https://github.com/turnkeylinux/tracker/issues/1184#issuecomment-1608798768

Also, most settings require a restart for them to be applied. I.e. to apply CouchDB settings, restart Couch DB, to apply Nginx changes, restart Nginx.

JedMeister avatar Oct 16 '23 02:10 JedMeister