I have a React app hosted in Cloudflare Pages. It also has a Custom Domain setup through Cloudflare (also managed through Cloudflare). Because of this, it has two domains setup (my
customdomain.com and a
whatever.pages.dev one. I am getting a CORS error when fetching the Cloudflare analytics code
Access to XMLHttpRequest at ttps://cloudflareinsights.com/cdn-cgi/rum` from origin subdomain.customdomain.com` has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
It works fine on the default domain
The error seems to be with how the CORS headers are generated/matched with the analytics code - it is not recognizing my custom domain. Is this a bug? Can I generate analytics code for my custom domain somehow? (not interested in the automatic domain generated).