X-Accel-Redirect for mp4 provides unsupported video type in Internet Explorer for Windows 7 only
I am trying to execute mp4 on html5 tag video
using NGINX header X-Accel-Redirect
. Here's an example link (second video works, served directly):
https://www.sonoclipshare.com/testfiles/test.htm
Works fine for mp4s for Chrome / Safari / FF but only gets error in IE 11 only for Windows 7. Also, I can use X-Accel-Redirect to deliver any other file in a way (via xfiles.php below) - it is fine works on Win7 / IE11.
Unsupported video type or wrong file path.
The video works fine on IE when served directly. I suspect this is something specific as I have my headers. Here's a simple html:
<video width="800" controls>
<source src="xfiles.php?&file=001.mp4" type="video/mp4">
</video>
And 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;
Here's the output working curl -I
in a file
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
And here is the output curl -I
for the directly served (running) file:
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
DETAILS (INQUIRY):
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
DESCRIPTION (REACTION):
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
source to share
No one has answered this question yet
Check out similar questions: