Answer the question
In order to leave comments, you need to log in
How to make video download in nginx?
Hello everyone, how to implement the return of the video for downloading if there is a pointer GET parameter in the link? For example, so that a direct link sitename.com/video/name.mp4 would show a video online, but if you specify ?download=video after name.mp4, then the server would give this video for downloading and add a title.
Found this example
location ~* /video/(.*)$ {
add_header Content-disposition "attachment; filename=$1";
root /var/www/site.com/video;
}
location /video/Disk1/ {
if ($request_filename ~ "^.*/(.*)?download=video$"){
set $fname $1;
add_header Content-Disposition 'attachment; filename="$fname"';
}
}
Answer the question
In order to leave comments, you need to log in
if ($arg_download = "video") {
add_header Content-disposition "attachment"
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question