Web Analytics CORS error

What is the name of the domain?

rieves.art

What is the error message?

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://cloudflareinsights.com/cdn-cgi/rum. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.

What is the issue you’re encountering

I’m trying to setup automatic Web Analytics for my Cloudflare pages site which is fully managed by Cloudflare. If I enable the automatic setup toggle, the analytics scripts get added to my site, however when opening the site I get CORS errors. If I open the analytics dashboard, its also empty…

What steps have you taken to resolve the issue?

I’ve tried manually setting up analytics by installing a JS snippet but got same results.

What are the steps to reproduce the issue?

  1. Open the site in Firefox or Edge
  2. Open dev console and switch to the network tab
  3. Refresh the site
  4. Notice the CORS error

What feature, service or problem is this related to?

Web Analytics

Screenshot of the error

There’s another issue, you’re caching whole page including all the resources and you’re serving quite a lot of video files which are loading and blocking the page, despite you might get into violation of the ToS since serving so much videos on a single page over a proxied :orange: hostname.

There’s another issue, you’re caching whole page including all the resources and you’re serving quite a lot of video files which are loading and blocking the page

Do you mean that a lot of videos get loaded on page load on your side or? I have lazyload setup and from my tests on multiple browsers this case should be covered - videos should only load once you uncover them. Also, is caching somehow misused here, my site changes rarely and I think it makes sense to cache all content. Perhaps I’m missing something here and you have some recommendations?

despite you might get into violation of the ToS since serving so much videos on a single page over a proxied :orange: hostname.

I was not aware of this - does this mean that such pages (single page, lots of video files) are simply not possible on CF due to ToS, even with lazyload? Could you perhaps link the ToS line which covers this?

…while this is a bit off topic, I appreciate you mentioning this. I’ve been trying to optimize the video situation on this site for quite some time without loading in a large chunk of JS. So I’m up for hearing tips!

I seem to have resolved this, my steps were:

  1. Disabled Web Analytics in CF pages page at: Compute (Workers) > Workers & Pages > rieves-art > Metrics > Web Analytics > Disable
  2. Disabled Web Analytics in main dashboard: Analytics & Logs > rieves.art > Manage site > Toggle Web Analytics
  3. Restarted the previous build
  4. Re-enabled Web Analytics in main dashboard: Analytics & Logs > rieves.art > Manage site > Toggle Web Analytics
  5. Restarted the previous build

The CORS issue went away, still no data though so will wait a bit and will report back in this thread and mark as solved if I don’t forget :sweat_smile:

Some random thoughts for anyone from CF team reading this: the pages UI became way more confusing recently than what I remember it was a few years back:

  • Why is CF Pages config under “Compute (Workers) > Workers & Pages”? I recall there used to be a single “Pages” tab for all the pages related things. It defo used to be way more clear, now I constantly catch myself searching for the Pages related functionality when returning to CF to change configs every few months or so.
  • The “Web Analytics” features are super confusing - why are there two places where I can toggle this feature? Or are these separate somehow? I only managed to find this magical “Disable” checkbox by annoying ChatGPT for a couple of hours >.>
1 Like

I can confirm that metrics are being collected now, will close the thread.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.