How can i setup a range byte response?

I have a lot of small videos (mp4s) literally like 2kb to 20kb for small animations at It works on chrome, firefox but

safari need us to support range-byte header response. I would like to know how to set it up for videos.

Thank in advanced :slight_smile:

It should be pretty simple:

app.static("/", "/path/to/file", use_content_range=True)

Thank you for letting me know :heart:

Is it a better way that Nginx Web Server process the static files ,such as css, js, video and so on, whereas Sanic take responsibility for data retrieval? Thanks.

If you are already using nginx as a proxy, and it has access to the files, then I would. Nginx will always be more efficient at serving static files than any python application.

If you are not using is already, or your deployment is not easy to configure it, this might not be necessary. I would take into consideration: the amount of expected traffic, the deployment strategy, and application architecture to determine if the effort is necessary. For larger scale deployments, you may even find nginx to be insufficient and that you need instead to use a CDN.

There’s no one single answer to say what is better. It is application and use case specific.

The more I talk to you, the more I learn from you. Then great thanks to you. :smiley:

1 Like