3

I have a simple fetch call to an audio file on S3, and am using the Content-Length header to generate a loading progress bar. On Chrome and Safari, this is totally functional, but Firefox is returning null for `res.headers.get('Content-Length').

const res = await fetch(src)
const length = res.headers.get('Content-Length') // null on Firefox

Has anyone experienced similar issues? My suspicion was the browser restricting CORS access, but I have not been able to find a solution.

Ryan McHenry
  • 49
  • 1
  • 1
  • 5
  • 2
    In my case, I was making a HEAD request to retrieve the object size and got the same issue. I solved it by adding `Content-Length` to my bucket CORS configuration – Andres Aug 27 '20 at 17:36
  • @Andres Thank you very match! Your tip helped. Maybe make a proper answer? – Andrej Feb 22 '21 at 17:54

0 Answers0