Front-end rendering doesn't work if using a CDN?

Still debugging this, but I noticed that once I added my CDN link to WP Rocket, the grid on my homepage wasn’t loading anymore.

Here’s the console error:

Access to script at 'https://domain.b-cdn.net/wp-content/plugins/cwicly/assets/js/ccdyn/main.js?ver=1.2.9.5.3.2' from origin 'https://domain.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Is that unintentional behaviour?

EDIT: Checking to see if maybe I have something incorrectly setup on the CDN, as I’m noticing another script getting blocked as well.

EDIT 2: Ah, pretty sure it’s because I had this unchecked on Bunny:

Samething happened with Bunny CDN, only archieve pages which have front end render enabled displayed empty area.

1 Like

Hi @sunny,

As the error suggests, this is CORS related.
Make sure to enable JS for your headers in BunnyCDN.

4 Likes

Strangely it started working after enabling the cache setting (now that I think about it… maybe because it was loading from origin on the first few refreshes).

That makes sense though, I added js to the inclusion as well and all is good now :slight_smile:

1 Like