How can we enable byte-range requests?

jols

Well-Known Member
Mar 13, 2004
1,110
3
168
Hi Folks,

I just received this from a hosted customer on our newest cPanel server, and for the life of me, I can find very little info about this:

-----------
I'm attempting to get our RSS feed on our site indexed in itunes, but I keep getting the same error message when I attempt to set it up:

"There is a problem with your feed. Your episodes are hosted on a server which doesn't support byte-range requests. Enable byte-range requests and try your submission again."

Does anyone know how we could enable byte-range requests for this guy?

Thanks much.
 

gkgcpanel

Well-Known Member
Jun 6, 2007
214
0
166
cPanel Access Level
DataCenter Provider
So, Apple has this to say to people who ask them about Byte-Range Requests:

Because of the number of complaints there have been of iPhones not being able to play some podcasts, Apple now require the server you host your media files on to have 'byte-range support' enabled - basically this means coping with requests for only part of a file at a time, which is required for the iPhone. You should confirm with your hosting service that they support this: if they don't (or don't know what it is) you should find another hosting service. Note: cPanel servers do not support byte-range requests.

Note that this applies to the server which hosts the episode files, not the feed - they don't have to be on the same server, though often they are, but it's not an issue with the feed at all.
So we will start losing hosting customers because cPanel can't support this.. But then I found an FAQ on another hosting provider. and they do run cPanel.

Apache has Byte Range Requests enabled by default and it is enabled on all our Linux Hosting options, including Shared, Reseller, SEO Hosting, VPS & Linux Dedicated Servers.
So apparently cPanel *CAN* support byte-range requests. We just need to find out how the hell to enable it.

Anyone from cPanel support/development care to chime in here???
 

mtindor

Well-Known Member
Sep 14, 2004
1,361
64
178
inside a catfish
cPanel Access Level
Root Administrator
It's interesting how you read that. You read it as "cPanel sucks because they don't support byte range requests." I read it as "Apple, like any large company who likes to push everyone around, passes the buck yet again."

Regardless of whether or not cPanel should / could / would support byte range requests, Apple sucks for blatantly passing the buck like that. The iPhone requires that because that's the way Apple likes it. So Apple should not be insinuating that cPanel hosting is garbage and that everyone should find a non-cPanel hosting environment.

Mike
 

Jeff Shotnik

Well-Known Member
Oct 10, 2012
61
0
6
Denver, Colorado, United States
cPanel Access Level
DataCenter Provider
I don't see this as a cpanel issue at all. Likely you're using apache, that is where you need to enable byte range requests. if mod_headers is loaded, you should be able to use the 'Accept-Ranges' directive for this.
 

mtindor

Well-Known Member
Sep 14, 2004
1,361
64
178
inside a catfish
cPanel Access Level
Root Administrator
Incidentally, all the cpanel servers I manage do indeed support byte range requests. If yours doesn't, perhaps your host [in the past] had specifically made some changes to prevent a certain DOS ( http://httpd.apache.org/security/CVE-2011-3192.txt ) and then didn't undo the mitigation changes once they updated to a version of Apache that fixed that vulnerability.

I got these instructions off the net [to test whether the server supports it]:

1. Create a file [such as testrange.php] and put the following in that file:

Code:
<?php
$range = '60-120';
$host = "www.yourdomain.com";
$socket = fsockopen($host,80);
$packet = "GET /path/to/some/image.png 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);
?>
2. Modify the above code to point to your domain and a static file

3. "php testrange.php"

You should get a result similar to this:

[[email protected] ~]# php testrange.php

HTTP/1.1 206 Partial Content
Date: Tue, 26 Mar 2013 17:39:30 GMT
Server: Apache
Last-Modified: Fri, 08 Feb 2013 07:39:05 GMT
Accept-Ranges: bytes
Content-Length: 61
Content-Range: bytes 60-120/455
Connection: close
Content-Type: image/png

m
 

gkgcpanel

Well-Known Member
Jun 6, 2007
214
0
166
cPanel Access Level
DataCenter Provider
Mike,

Thank you. I found a similar piece of code online and used it to test and it showed Accept-Ranges: none. But yours above shows Accept-Ranges: bytes. So it does appear that we are already supporting Byte Range Requests.

So I wonder why Apple (and I do hate them and think they are wrong in pushing people to other hosts) reports that Byte-Range Requests are not active when in fact they are?

Thanks again.


Incidentally, all the cpanel servers I manage do indeed support byte range requests. If yours doesn't, perhaps your host [in the past] had specifically made some changes to prevent a certain DOS ( http://httpd.apache.org/security/CVE-2011-3192.txt ) and then didn't undo the mitigation changes once they updated to a version of Apache that fixed that vulnerability.

I got these instructions off the net [to test whether the server supports it]:

1. Create a file [such as testrange.php] and put the following in that file:

Code:
<?php
$range = '60-120';
$host = "www.yourdomain.com";
$socket = fsockopen($host,80);
$packet = "GET /path/to/some/image.png 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);
?>
2. Modify the above code to point to your domain and a static file

3. "php testrange.php"

You should get a result similar to this:

[[email protected] ~]# php testrange.php

HTTP/1.1 206 Partial Content
Date: Tue, 26 Mar 2013 17:39:30 GMT
Server: Apache
Last-Modified: Fri, 08 Feb 2013 07:39:05 GMT
Accept-Ranges: bytes
Content-Length: 61
Content-Range: bytes 60-120/455
Connection: close
Content-Type: image/png

m
 

mtindor

Well-Known Member
Sep 14, 2004
1,361
64
178
inside a catfish
cPanel Access Level
Root Administrator
Mike,

Thank you. I found a similar piece of code online and used it to test and it showed Accept-Ranges: none. But yours above shows Accept-Ranges: bytes. So it does appear that we are already supporting Byte Range Requests.
Keep in mind that the results I showed were when querying my own server. I did not query yours. If you queried yours and the server shows Accepted-Ranges: none, then I'd guess your server has something set in the apache configuration to disable it. Just know that isn't how it's configured by default with cPanel.

I wonder if your host has a new installation template setup that automatically disables ranges in some way, even though there is no problem [that I know of] on current versions of apache.

I think those kinds of things can be modified via an .htaccess file as well, so be sure you don't have something in an .htaccess file for that particular customer's site that is causing ranges not to be supported.

Mike

So I wonder why Apple (and I do hate them and think they are wrong in pushing people to other hosts) reports that Byte-Range Requests are not active when in fact they are?

Thanks again.[/QUOTE]