Can't upload PDF to S3

AI-generated summary

The discussion revolves around issues with uploading PDF files to S3 in a self-hosted Docker Discourse installation. Initially, Andro reported being unable to upload any files, including images, despite following previous posts and configuring the allowed file suffixes list. pfaffman suggested that the issue might be related to S3 configuration, pointing to relevant guides for setup.

After resolving the S3 issue, Andro reported successfully uploading images but still encountered problems uploading PDFs, even when the file size was below the set limit. The error message indicated that the file was too large, despite the limit being 40 MB.

Andro eventually discovered the solution, which involved adding client_max_body_size to the nginx reverse proxy server for Discourse. pfaffman acknowledged the fix, noting that such issues can be difficult to resolve without prior knowledge.

Trying to upload PDF’s I have followed all the posts here on how to do it and nothing works - always blocked even if smaller than limit size set. I have added ‘pdf’ to the allowed file suffixes list. Consequently created an AWS Free Tier S3 account and a backet. Nothing uploads to S3, not even images.

I appear to be hopelessly lost. Any pointers as to why using S3 with proper access keys wont work?

Self hosted Docker install.

So it’s not a PDF issue, but an S3 issue. DId you follow Using Object Storage for Uploads (S3 & Clones) or Setting up file and image uploads to S3?

So I spent the time learning the details of Amazon S3, Cloudfront and so on. I am happy to report it uploads great!

But still totally unable to upload any PDF. I can’t quite see how this could be S3 related given that other files work fine - but I may be wrong.

No matter what size I set for file uploads and no matter what size a PDF is, I can’t upload them. I always get:

Sorry, that file is too big (maximum size is 40 MB). Why not upload your large file to a cloud sharing service, then paste the link?

I followed the instructions for how to increase file upload size but no size PDF will upload, includng sizes well below the limit. I am on the absolutely most update commit set of Discourse.

Finally figured it out at last. I had to add client_max_body_size in the nginx reverse proxy server for discourse. In hindsight this is obvious, but it takes time to see sometimes!

Good catch! So obvious… once you know. Stuff like that is hard to figure out and why standard installations are (mostly) so that’s supported here.