How can i enable byte range request?

Apache handles it out of the box for static content. If the content is being generated by PHP then you'll need to amend your PHP code accordingly.

Supposedly the http_send_file() and http_send_data() functions handle range requests - but I'm not sure what that means in practice - some experimentation required.


Apache supports the Byte-Range request out of the box - assuming it's not been explicitly disabled to get around this DoS bug (http://httpd.apache.org/security/CVE-2011-3192).

You can test with something trivial like the following (in PHP) :

<?php
$range = '60-120';
$host = "my.domain.name";
$socket = fsockopen($host,80);
$packet = "GET /path/to/static/file.xml HTTP/1.1\r\nHost: $host\r\nRange:bytes=$range\r\nAccept-Encoding: gzip\r\nConnection: close\r\n\r\n";
fwrite($socket,$packet);
echo fread($socket,2048);

Running the above, should result in something like the following :

HTTP/1.1 206 Partial Content
Date: Tue, 10 Jul 2012 11:17:55 GMT
Server: Apache
Last-Modified: Tue, 10 Jul 2012 10:12:23 GMT
Accept-Ranges: bytes
Content-Length: 61
Content-Range: bytes 60-120/6433
Connection: close
Content-Type: text/xml

tp://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
<ch

If the above doesn't work, then it's likely someone's turned off the Range header - see the above URL for suggestions of what to look for in either .htaccess files or the global Apache configuration.