MIME type not supported


I have a domain configured on Cloudflare that points to my static website on AWS CloudFront.

I’m constantly getting errors like this

domain Refused to apply style from main.638159b6.css because its MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled.
domain Refused to execute script from xxx/main.09a8d2d9.js because its MIME type (‘text/html’) is not executable, and strict MIME type checking is enabled.
domain Error while trying to use the following icon from the Manifest: logo192.png (Download error or resource isn’t a valid image).

If I access the CloudFront distribution directly, it works just fine.

Sometimes, but NOT ALWAYS, when I turn on the cache development mode, it starts working again, but later the issue is back.

I have some header modifications on the response, but I have already disabled all of them and the issue persists.

I see a lot of people have faced the same issue but didn’t find any solution.

Thank you all!