Serving public files

I want to move some of our public downloads from AWS to the Digital Ocean instance that houses our Discourse forums. I can’t get it to work entirely.

I created a directory: /var/discourse/shared/standalone/uploads/files
I put in that directory a .png and a .dmg to test.

The .png works, the .dmg gives a 404.



and because I wasn’t entirely sure if it was needed, I added it as an authorized extention

Can anyone see what else I might be missing?

Rather than serving files through your Discourse it might be best to use this guide to serve them from a seperate domain on the host:


Try removing the period from the extension. Use dmg instead of .dmg in the list of authorized extensions. Same for other extensions in your list.

@Cameron_D - I will try

@omarfilip - changing that doesn’t work

You’re right - that doesn’t make a difference. I tested a .dmg file on my instance via normal file upload through the composer (to /uploads/default/original/2X/6/62938a16f8677633f469a3eb4a2c95753db314.dmg) and it works.

A couple things to try:

  1. Upload a test file via the composer.
  2. Use a file without extra periods in the name.

@omarfilip Thanks

  1. I can try this, but it wont be in the directory I want these files in

  2. Doesn’t help.

1 Like

Images work because NGINX is serving them.

Attachments (ie. non-image files) don’t because they go through the rails stack and require an Upload record.


@zogstrip and if I fork and change these files to do what I want then I need to worry about future merges. This is a great explanation!