CouchDB - 413 - Request Entity Too Large
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.
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.
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.
Just grabbed this image (17.1-1) and the changes above don't appear to be in the config? @JedMeister
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
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.
Haha yeah, I sorted it out from the linked commit 😄
Thanks for being responsive!
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?
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.