What is the maximum file size we can upload on discourse?

AI-generated summary

The discussion revolves around the maximum file size that can be uploaded on Discourse. Kanishk_Jaswal started the conversation, stating that despite setting a maximum file size of 184 MB, uploads of 40-50 MB were failing.

Ivan_Rapekas shared their experience, where they were only able to upload files of 1 MB despite trying to increase the maximum upload size through various methods, including editing nginx configurations and app.yml parameters.

Merefield suggested that the issue might be caused by the nginx configuration being rebuilt every time, which would reset the changes. They also provided a solution, which involved updating the app.yml file to increase the maximum attachment size.

Ivan_Rapekas eventually discovered that the issue was caused by an incorrect setting in their external proxy server. They were able to resolve the problem by moving the client_max_body_size directive to the default nginx configuration file.

The solution is supported by the Discourse meta article Changing max attachment size, which was referenced by ondrej.

Hi all,

Curious to know what is the maximum allowed file size that can be uploaded on the platform?

Currently, we have it at 184 MB. However, when I try to upload a file of 40-50 MB it fails to upload.

Thanks in advance.
Kanishk

You probably need to change your nginx config too

Sorry for bumping this topic. I tried everything to change max upload size but my instance allows only 1 (one) mb to attach. I played with 10, 20mb and defaults.

I got client_max_body_size 100m;:

1. using custom command `sed -i 's/client_max_body_size 10m;/client_max_body_size 100m;/g' /etc/nginx/conf.d/discourse.conf`
2. using param `upload_size: 100m` in app.yml
3. by hands inside the container

1 and 2 - I rebuilt app, 3 - reload nginx inside container.

This is a fresh installation, only official plugins. Custom things are: Office 365 login and self-signed certificate (because the server is located inside intranet, and Office 365 login requires https). Everything works: login, emailing, answering by email. But attachment size is about 1 mb max (both files and pictures). I allow * for filetypes. I have external proxy Nginx with the same setting om 100mb body size.

I really confused. I’ve been using Discourse for 4 years. Do I have incorrect settings or conflicts? Could somebody navigate me what to check first please?

Hi @merefield,

@Ivan_Rapekas is right. It just doesn’t work. Some backend restriction that just doesn’t allow us to increase upload size of a file.

Have you read through this?

Yup that’s a better solution as imagine nginx config gets rebuilt every time which might be why the configuration is not persisted if you amend it directly :+1:

Initially (inside container):

image

Update app.yml to :

image

Post rebuild:

image

So perhaps that was your problem @Kanishk_Jaswal , it was being reset each rebuild?

Sure. I researched all relevant topics. The strange thing is 1mb size. It would enough 10mb for me, but I can’t reach this.

Thanks for this point, I checked it - seems settings are ok…

indeed, and you said earlier “about” 1mb, even weirder.

Any possibility of an unusual firewall/router/network/vpn setting ? Does the app give you an error, or does the upload fail silently?

Thank you for the support. I realized that external proxy might have incorrect body size setting. Just checked the log..

Seems that’s my fault. Hope I’ll fix it soon and return the correct setting for external Nginx.

Thanks to all.

So, I have Nginx in front of Discourse. It has configs:

/etc/nginx/nginx.conf (default)
/etc/nginx/conf.d/discourse.conf (custom)

Both configs have server{} sections. First I put client_max_body_size 100m; in custom config. Actually the setting did not work, but I did not check proxy logs.

When I moved client_max_body_size 100m; to default config (parent config), the problem resolved.

So, Change the maximum attachment/upload size article is actual. The root cause was in external proxy setting, outside of Discourse which is the best :slight_smile: .