-
Notifications
You must be signed in to change notification settings - Fork 30
htaccess
Tomasz Oponowicz edited this page Jul 18, 2014
·
10 revisions
Generally speaking, the Adobe Flash Player doesn't allow the Range
header. One workaround is to use a custom query for every GET
request, e.g. ?range=0-499
.
Use the snippet below to create a new .htaccess
file and place it in the root folder of your hosting.
<IfModule headers_module>
<IfModule rewrite_module>
# ^(.*) if .htaccess in a root; ^/(.*) otherwise
RewriteEngine On
RewriteCond %{QUERY_STRING} ^(.*)bytes=(.*)$
RewriteRule ^(.*) - [L,E=range:%2]
RequestHeader set Range "bytes=%{range}e" env=range
</IfModule>
</IfModule>
In order to validate your setup, execute command like:
curl -v -- "http://dashas.castlabs.com/videos/bytes/bbb/Manifest.mpd?bytes=0-18"
Your output should be similar to:
* Adding handle: conn: 0x7fbf23004000
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fbf23004000) send_pipe: 1, recv_pipe: 0
* About to connect() to dashas.castlabs.com port 80 (#0)
* Trying 176.34.236.36...
* Connected to dashas.castlabs.com (176.34.236.36) port 80 (#0)
> GET /videos/bytes/bbb/Manifest.mpd?bytes=0-18 HTTP/1.1
> User-Agent: curl/7.30.0
> Host: dashas.castlabs.com
> Accept: */*
>
< HTTP/1.1 206 Partial Content
< Date: Fri, 18 Jul 2014 09:20:14 GMT
* Server Apache/2.2.22 (Ubuntu) is not blacklisted
< Server: Apache/2.2.22 (Ubuntu)
< Last-Modified: Sun, 23 Feb 2014 19:13:47 GMT
< ETag: "1c0011-937-4f317a782b0c0"
< Accept-Ranges: bytes
< Content-Length: 19
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: range
< Content-Range: bytes 0-18/2359
<
* Connection #0 to host dashas.castlabs.com left intact
<?xml version="1.0"~
...please make sure that 206 Partial Content
and Content-Range: bytes 0-18/2359
are present.