Roots Discourse

Resources blocked by CORS policy

Hi, I’m racking my brain with this one and I have lost a lot of time trying to figure this out.

I have several Sage 8.6 projects that I maintain. They all run off the same Vagrant instance each as virtual hosts. Today I needed to make some updates to a project. When I fired up gulp && gulp watch I noticed all fonts including font awesome are being blocked by CORS policy when viewed through browser sync.

Access to font at 'http://oph.test/wp-content/themes/oph/dist/fonts/fa-solid-900.woff' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

My other projects are working fine.

I have removed my node_modules folder and re-ran npm install. My package.json and gulpfile.js are exactly the same as other working projects which also matches up to the 8.6 git branch. I have also tried adding some CORS lines to my gulpfule.js by I ended up making a mess and browser sync wouldn’t start. There are no errors running gulp && gulp watch.

If you could help me out, I would be greateful.

Ok, I have resolved this.

It was an issue from a caching plugin that was disabled but still interfering somehow.
In my plugins, the caching plugin Breeze was disabled. I re-enabled the plugin, cleared cache then disabled the plugin again and just like that it began to work again.

Possibly, when I resynced the site files, the plugin didn’t get a chance to run any actions on plugin disable.

So sorry, for this useless post.