/ Moorsalin's Blog

Cross Origin and Github

I host this blog using Github Pages. Some resources such as CSS and JS are hosted external and others with the same origin. I encountered some CORS errors with CSS files hosted on Github Pages. There were no “Access-Control-Allow-Origin: *” HTTP headers being passed. The Hugo template I am using, hugo-flex, adds crossorigin attributes when loading the base css stylesheet. Github uses Varnish for serving up pages. Removing the attributes let the CSS files be served without CORS error. It is now magically working with the crossorigin attributes added. Strange voodoo happening here.