Nginx force download for non image static files


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. server{
  2. listen 80;
  3. server_name test.localhost;
  4. location / {
  5. root /Users/vasil/test;
  6. if ($request_filename !~* ^.*?\.(jpg)|(png)|(gif)){
  7. add_header Content-Disposition: "$request_filename";
  8. }
  9. }
  10. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.