spantaleev / matrix-docker-ansible-deploy

🐳 Matrix (An open network for secure, decentralized communication) server setup using Ansible and Docker
GNU Affero General Public License v3.0
4.76k stars 1.03k forks source link

Unable to stream files from server #297

Open vjoomens opened 4 years ago

vjoomens commented 4 years ago

Hi, I can't find any configuration to allow media streaming from the server. I get errors like "the server is not correctly configured" and does not allow byte range requests. Please help.

vjoomens commented 4 years ago

So it turned out the fix was real easy. Just add the line below to the nginx proxy template, or add this line to a new file in the conf.d directory:

proxy_force_ranges on;

spantaleev commented 4 years ago

Hi!

Seems like Synapse doesn't support media streaming. See: https://github.com/matrix-org/synapse/issues/4780

I guess proxy_force_ranges on is some workaround, which downloads the whole file at the reverse-proxy and slices it over there?

Given that media files are generally small-ish, it may not be much of a problem to force such a workaround. Still, we might prefer to do it for the /media endpoints only.

spantaleev commented 4 years ago

@vjoomens, if you've got any more feedback on your experience with proxy_force_ranges, I'd be happy to hear it.

I'm a little wary about implementing it, especially for servers that have increased their media size limit. If we do implement it, it should probably be configurable, so people could disable it.

Imagine a 300MB media file, which nginx needs to cache (in memory?) for a long-long time, so that it can slice it and serve ranges.. Sounds like a good way to cause denial-of-service..

Of course, it may be that nginx acts smarter and it's not as dangerous.. I haven't tested it, nor could I find much information about how proxy_force_ranges works.

greentore commented 4 months ago

Is there a way to achieve something similar to proxy_force_ranges on with Traefik?