Summary
Download servers usually deliver media files “as is” to a browser. Most of the times, browsers tend to try to open the files directly offering immediate playback. As web players are common these days, this behaviour is not ideal as most users expect the content to be downloaded to disk directly.
In order to enable forced downloads, you need to change the configuration of your download server. The video shows how to do that and you will find example configurations for Apache and nginx web servers below.
Apache Config
<FilesMatch "\.(mp3|m4a|ogg|oga|opus|flac)$">
Header set Content-Disposition "attachment"
</FilesMatch>
AddType audio/mpeg mp3
AddType audio/mp4 m4a
AddType audio/ogg oga ogg
AddType audio/opus opus
AddType audio/flac flac
nginx Config
location ~* (mp3|m4a|ogg|oga|opus|flac)$ {
add_header Content-Disposition "attachment; filename=$1";
}
http {
types {
audio/mpeg mp3;
audio/mp4 m4a;
audio/ogg oga ogg;
audio/opus opus;
audio/flac flac;
}
}