Scenario
I am serving my hls videos on S3 with Cloudfront and play them with hls.js library
Problem
Sometimes I am getting CORS errors, the weird part is if I disable cache in the browser, it's working fine, but when it's use the cached version it returns the CORS error
Access to XMLHttpRequest at 'https://a-subdomin.cloudfront.net/myvideo.m3u8' from origin 'https://www.example.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Configs
Here is my Cloudfront behavior config
I tried many ways, but I don't know what is the problem, I am thinking maybe it's about hls.js library!