开发中遇到了一打开MP4文件就进行下载的问题,排查发现是浏览器有迅雷插件,而且MP4的媒体Content-Type类型是application/octet-stream,这就导致迅雷识别为需要下载,然后就弹出了下载框。
现解决方案为修改nginx配置,对MP4后缀文件进行处理,强制修改Content-Type类型为:video/mp4。
配置如下:
location ^~/minio/ { if ($request_uri ~* \.mp4$) { rewrite ^/minio/(.*)$ /_mp4_path/$1 last; } internal; proxy_no_cache 1; proxy_set_header Referer $minio_referer; proxy_pass http://###.com/rms-test/; } location ~ ^/_mp4_path/(.*)$ { internal; proxy_no_cache 1; proxy_hide_header Content-Type; add_header Content-Type video/mp4; proxy_set_header Referer $minio_referer; proxy_pass http://###.com/rms-test/$1; }