Reputation: 324750
I've been trying to get background music working for my browser-based game. It's working great, but in Chrome I frequently have the music cut short and this error appears:
Failed to load resource: net::ERR_CONTENT_LENGTH_MISMATCH
I watched the Network tab and saw the audio file being loaded as it should be, with the 206 Partial Content status, until it hit that error and just stopped.
Reloading the page will usually yield the same result, but at a different point in the track. I have yet to encounter this problem in IE, it seems to only be Chrome that's affected.
Any suggestions as to what may be happening?
Example request/response:
GET /music/___________.mp3 HTTP/1.1
Host: ____________.net
Connection: keep-alive
Accept-Encoding: identity;q=1, *;q=0
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36
Accept: */*
DNT: 1
Referer: http://____________.net/
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
Cookie: SID=XXXXXXXXXX
Range: bytes=0-
HTTP/1.1 206 Partial Content
Date: Tue, 26 Aug 2014 13:53:38 GMT
Server: Apache/2.2.26 (Unix) mod_ssl/2.2.26 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
Last-Modified: Fri, 13 Jun 2014 21:00:31 GMT
ETag: "219f1a-8ed344-4fbbdf7c339c0"
Accept-Ranges: bytes
Content-Length: 9360196
Content-Range: bytes 0-9360195/9360196
Connection: close
Content-Type: audio/mpeg
Upvotes: 9
Views: 15376
Reputation: 95
I was also facing this problem and the accepted solution didnət work for me. So, I leave my solution here for those who are also facing the error because this question comes up as the first result of the search.
I was running an Nginx server and was facing this error.
First, open /etc/nginx/nginx.conf
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
Then open your server configuration file, for me /etc/nginx/conf.d/default.conf
...
server {
...
server_name example.com;
chunked_transfer_encoding on;
...
location / {
...
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
...
}
...
}
If it doesn't work, try increasing the buffer size.
Upvotes: 2
Reputation: 324750
Increasing Apache's timeout
setting fixed it.
Basically Chrome was being "too clever" by only downloading fast enough to keep just ahead of the buffer, and Apache was getting bored.
Upvotes: 5