X-Accel-Redirect for mp4仅在Internet Explorer Windows 7上提供不受支持的videotypes

我正尝试使用NGINX X-Accel-Redirect标头在html5 video标签中提供mp4。 这是一个示例链接(第二个video作品,直接提供):

https://www.sonoclipshare.com/testfiles/test.htm

适用于Chrome / Safari / FF的mp4s,但在Windows 7上只能在IE 11上出现错误。 此外,我可以使用X-Accel-Redirect以(通过下面的xfiles.php)方式传递任何其他文件 – 它在Win7 / IE11上正常工作。

不支持的videotypes或无效的文件path。

当直接服务时,video在IE上完美运行。 我怀疑这是如何具体到我的标题。 这里是简单的html:

 <video width="800" controls> <source src="xfiles.php?&file=001.mp4" type="video/mp4"> </video> 

xfiles.php

 include('../cururl.php'); $murl = curPageURL(); parse_str($murl, $result); $filename=$result['file']; $folder=$result['folder']; $file="/var/www/uploads/" . $folder . "/" . $filename; $aliasedFile = '/protected/' . $folder .'/' . $filename; header('Content-Type: ' . mime_content_type($file)); header('Cache-Control: public, must-revalidate'); header('Pragma: no-cache'); header('Content-Length: ' .(string)(filesize($file)) ); header('Content-Disposition: inline; filename="'.$filename.'"'); header('X-Accel-Redirect: ' . $aliasedFile); exit; 

这是在文件上运行curl -I的输出

 HTTP/1.1 200 OK Date: Fri, 28 Apr 2017 13:50:47 GMT Content-Type: video/mp4 Content-Length: 1489903 Connection: keep-alive Set-Cookie: __cfduid=dae73721e3830a2bde51f3809bb87c47a1493387447; expires=Sat, 28-Apr-18 13:50:47 GMT; path=/; domain=.sonoclipshare.com; HttpOnly Last-Modified: Fri, 28 Apr 2017 12:18:10 GMT Set-Cookie: PHPSESSID=r2i6k2qjsrgs94ca8tu7uadb74; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: public, must-revalidate Content-Disposition: inline; filename="001.mp4" ETag: "59033302-16bbef" Accept-Ranges: bytes X-Frame-Options: SAMEORIGIN Server: cloudflare-nginx CF-RAY: 356a7e1a0af542e8-ATL 

这是直接服务(工作)文件的curl -I结果:

 HTTP/1.1 200 OK Date: Fri, 28 Apr 2017 15:34:31 GMT Content-Type: video/mp4 Content-Length: 1489903 Connection: keep-alive Set-Cookie: __cfduid=d1a0bcd70223005a0b5275494f71db40f1493393671; expires=Sat, 28-Apr-18 15:34:31 GMT; path=/; domain=.sonoclipshare.com; HttpOnly Last-Modified: Fri, 28 Apr 2017 13:45:59 GMT ETag: "59034797-16bbef" Accept-Ranges: bytes X-Frame-Options: SAMEORIGIN Server: cloudflare-nginx CF-RAY: 356b16116cf25e82-TPA URL Protocol Method Result Type Received Taken Initiator Wait‎‎ Start‎‎ Request‎‎ Response‎‎ Cache read‎‎ Gap‎‎ /testfiles/xfiles.php?file=002a.mp4&folder=R4mtqwYN3d HTTPS GET (Aborted) text/html 278 B 62 ms 94 31 31 0 0 147 

详情(请求):

 Key Value Request GET /testfiles/xfiles.php?file=002a.mp4&folder=R4mtqwYN3d HTTP/1.1 User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko Accept */* Referer https://www.sonoclipshare.com/testfiles/test.htm GetContentFeatures.DLNA.ORG 1 Pragma getIfoFileURI.dlna.org Accept-Language en-US Accept-Encoding gzip, deflate Host www.sonoclipshare.com DNT 1 Connection Keep-Alive Cookie __cfduid=dfc9dd3e27defddfbafa2c0a6dbdab2151493386292; _ga=GA1.2.832748637.1493386815 

详情(RESPONSE):

 Key Value Server nginx/1.11.3 Response HTTP/1.1 403 Forbidden Keep-Alive timeout=20 Date Tue, 02 May 2017 13:54:25 GMT Content-Type text/html Content-Length 178 Content-Disposition inline; filename="" Connection keep-alive Cache-Control public, must-revalidate