I'm having some issues with MP4 byte range caching and Apple browsers. I have a cache node that grabs content from a backend node, and caches it, and then serves it to users. This is done using nginx proxy_pass along with nginx caching.

I found that many browsers will first request the whole video (byte range 0-infinite) first, and then request chunks afterwards. This was an issue because it would cause the cache node to download the whole video from the backend at once. To fix this, we had the cache node split the requests into 10M chunks, no matter how big the byte range requested was. This worked for almost all browsers, except Safari. For both Desktop as well as iOS safari, Safari throws a media corrupt error almost instantaneously. The error is throw as soon as request is sent with the byte range set as the full file. If we don't rewrite the request, it works fine on Safari, but causes for the cache nodes port to be saturated almost all of the time, because when someone starts streaming a file, the whole file is downloaded to the cache node, saturating the port. Any suggestions on how I can fix this would be appreciated.

  • This sounds a bit like an XY problem - it sounds a little like your having changed your cache node's behaviour to try and fix the initial issue may now be causing other problems. What was the original issue you were trying to solve, that caused you to change the way your cache nodes were behaving? You might want to check into what playing with buffering could do (nginx.org/en/docs/http/…) – iwaseatenbyagrue Mar 10 '17 at 8:34

Your Answer

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

Browse other questions tagged or ask your own question.