Earlier quoted context omitted.
If you serve your static files from a CDN it's simply not possible to do so. It's a very common case.
Can you provide an example, just so we can be on the same page? You do an XmlHttpRequest or fetch() to a static asset and it's a non-trivial request to CDN, I just wonder how it looks like and why it exists in the first place.
Basically that won't work besides making your CDN somehow proxy requests for which not static file exists.