I am using resumable upload with no problem on chromium browsers. I use js, specifically angular.
let headers = new HttpHeaders(
{
'Content-Type': 'application/octet-stream',
'Content-Range': 'bytes 0-*/*',
});
if (offset) {
headers = headers.set('Content-Range', 'bytes ' + (offset + 1) + '-*/*');
params = (params.slice(offset + 1) as File);
}
const req = new HttpRequest(
'PUT',
url,
params,
{ headers, reportProgress: true },
);
return this.http.request<File>(req);
On firefox, for some reason, if the file is over 5GB, it fails nondeterministically of time, uploaded size or percent of upload. Usually it is around 300s and/or 2-3GBs. The upload starts fine, but somewhere on the way it fails.
I get a CORS error at that point and am unable to resume the upload.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://storage.googleapis.com/repo-name/uploads/guid?upload_id=blahblah&uploadType=resumable. (Reason: CORS request did not succeed)
I tried manually upload the same set of files to google drive manually in firefox and sure enough, I also get the CORS error, but their implementation is better I guess, because they are able to resume the upload, but after a while it throws the same error.
The only difference I see is I am trying to do one PUT request (unless it fails, then I send the other chunks in seperate one), on google drive, they chunk it and do a bunch of PUTs. They also correctly identify the content-type as ie. video/x-matroska, I use octet-stream.
It works for files under 4GB in firefox and works regardless of size in Chromium browsers. Any tips on what I am doing worng?