I have a local testing environment in a Fedora virtual machine. Strangely, resources (css and js files) don't seem to work. Looking at Firebug, I see that the browser sends the HTTP request with "Range bytes=0-". The server responds with either an empty 200OK or an empty 206 Partial Content.

Here is an example:

Response Headers
Date    Mon, 23 Nov 2009 23:33:26 GMT
Server  Apache/2.2.13 (Fedora)
Last-Modified   Thu, 19 Nov 2009 22:58:55 GMT
Etag    "18-3aec-478c14dbee138"
Accept-Ranges   bytes
Content-Length  15084
Content-Range   bytes 0-15083/15084
Connection  close
Content-Type    text/css

Request Headers
Host    fedora.test
User-Agent  Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20091105 Fedora/3.5.5-1.fc11 Firefox/3.5.5
Accept  text/css,*/*;q=0.1
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive  300
Connection  keep-alive
Referer http://fedora.test/pictures/
Cookie  __utma=26341546.1613992749.1258504422.1258569125.1258752550.4; __utmz=26341546.1258504422.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); PHPSESSID=tqf8jfmc77qihe97rl4tmhq685
Range   bytes=0-
If-Range    "18-3aec-478c14dbee138"

I don't know if the browser is sending the wrong request, or if it's the server that is doing this. Request made to the outside (such as google analytics) are working fine.

This is running in Fedora 11 in VirtualBox. Apache. PHP. The files are being served through the "shared folders" feature of VirtualBox (could it be related?).

No error logs could help me.

  • This may be unrelated to the problem. What do you mean by Strangely, resources (css and js files) don't seem to work. – Dave Cheney Mar 2 '10 at 3:17
  • I'm having the same problem. Very likely that VirtualBox shared folders is the culprit. – Adrian Schneider Mar 4 '11 at 19:42

This indicates that your server accepts the Range: header from the client, using the Byte format. Range is used for "Progressive download", also called "Resuming a download". When you download a file in Firefox for instance, using HTTP (not FTP), hit "Pause" and then "Resume", Firefox will send an HTTP GET to the server and add a Range: header in the request. The value of that header will indicate to the server what byte offset to start the data stream at.

This header is optional, according to the HTTP 1.1 Header Fields Definition RFC. That means the clients will still try to send the Range: header, but the server will just ignore it if it doesn't support that kind of requests. Therefore I would disable it because it just adds unnecessary bandwidth usage to your server.


Is there a chance that the account used to run apache / php doesn't have access to read the files from the "shared folders"? From your description it sounds like PHP doesn't have the problem, just the static files (so apache then?) ... maybe try creating a PHP wrapper to stream them?

if ($fp = fopen ($file_path, "r")) {
    while(!feof($fp)) {
        $file_buffer = fread($fp, 2048);
        echo $file_buffer;
} else {
    die('LOGGED! bad file '.$file_path);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.