Search code examples
javascriptgoogle-chromevideonginxpartial

Partial content request in Google Chrome


There are plenty of posts about Partial content issues with Chrome. But I'm really stuck and any suggestion doesn't help me so far. Here is my problem:

ENV:

  1. On server side use Node with MongoDB and files storing in mongo. I use GridFS to pickup files and sent to the client.
  2. I use Nginx as web server

I have a tag and need the video plays looping on the client. What I found, that Chrome is sending range request to the server:

GET /54c4d7c6849b10b54af4ac23.mp4 HTTP/1.1
Host: xxxx.com
Connection: keep-alive
Accept-Encoding: identity;q=1, *;q=0
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36
Accept: */*
Referer: https://www.xxxx.com/en-GB/
Accept-Language: en-US,en;q=0.8
Cookie: _ga=GA1.2.1593613130.1422274087
Range: bytes=26104-3116024

This request I handle in gridFS and reply with partial content following:

HTTP/1.1 206 Partial Content
Server: nginx/1.6.2
Date: Mon, 23 Feb 2015 13:47:48 GMT
Content-Type: video/mp4
Content-Length: 3089921
Connection: keep-alive
Content-Range: bytes 26104-3116024/3116025
Accept-Ranges: bytes
Cache-Control: no-cache

But after that Chrome stops show video. What's wrong in there? May I miss something in response header?


Solution

  • Issue solved Unfortunatelly Chrome is not very detailed in what happens in request/response. The problem is that size matters, actually. When size declared in Header different from actual content size. chrome just drop it with no reason. To identify this I set up Fiddler and found that my gridFS sends wrong file part size. Upgrading Gridfs to latest 1.0.1 version does solve this problem.