I want to serve large files (>1GB) over HTTPS. I am trying to use the range headers for this so that when the client (browser) requests the range of bytes, it will be served by the server. I have also put a maximum limit on the range i.e. 1MB.
The issue is browsers (tested on Chrome, Firefox) does not initiate range request. The code looks something like this:
@app.get("/download/<file_id>")
def download(file_id):
...
# some logic
...
return file_download_in_ranges(file_location, download=True)
The function file_download_in_ranges
checks whether the headers have Content-Range
header , if yes, it returns the chunk of data from file in specified range. I have tried to use the same API for HTML5 video player, which worked fine. But, when I create an anchor link with the same API, the browser does not initiate Range request cycle. Do range requests only work for browser inbuilt audio/video players?
Thanks in advance for the suggestions!