Skip to content

Set client_max_body_size for /cool to avoid 413 on large documents - #139

Open
ajoe wants to merge 1 commit into
YunoHost-Apps:testingfrom
ajoe:fix-client-max-body-size
Open

Set client_max_body_size for /cool to avoid 413 on large documents#139
ajoe wants to merge 1 commit into
YunoHost-Apps:testingfrom
ajoe:fix-client-max-body-size

Conversation

@ajoe

@ajoe ajoe commented Jul 10, 2026

Copy link
Copy Markdown

Problem

The nginx config doesn't set client_max_body_size, so nginx's default of 1M applies to the /cool endpoints. Any document larger than 1 MB that is POSTed to /cool/convert-to/... — which Nextcloud's richdocuments app uses to generate office file previews — is rejected by nginx with 413 Request Entity Too Large before it ever reaches coolwsd. The same limit applies to image/file uploads during editing.

On my instance this produced dozens of these entries in the Nextcloud log:

Failed to convert preview: Client error: `POST https://collabora.example.org/cool/convert-to/png`
resulted in a `413 Request Entity Too Large` response

Fix

Set client_max_body_size 100M; in the location ~ ^/(c|l)ool block (the "download, presentation and image upload" endpoint). 100M matches what other Collabora reverse-proxy setups commonly use and is far above typical document sizes while still bounded.

Test

Verified on a YunoHost instance (Collabora 25.04.10.3, Nextcloud 34): before the change, curl -F "data=@file.docx" https://<domain>/cool/convert-to/pdf fails with 413 for files > 1 MB; after adding the directive and reloading nginx, the conversion succeeds and Nextcloud office previews are generated again.

🤖 Generated with Claude Code

Without an explicit client_max_body_size, nginx's 1M default applies to
the /cool endpoints. Any document larger than 1 MB sent to
/cool/convert-to (used e.g. by Nextcloud richdocuments for office file
previews) or uploaded during editing is rejected by nginx with
"413 Request Entity Too Large" before it ever reaches coolwsd.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ajoe
ajoe force-pushed the fix-client-max-body-size branch from e2b4582 to 74058d6 Compare July 10, 2026 07:36
@rodinux

rodinux commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

!testme

@rodinux rodinux mentioned this pull request Jul 25, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants