Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access-Control-Allow-Origin HTTP header in Jekyll site in Github

After upgrading to latest Google Chrome I'm getting the following error.

Font from origin 'http://fonts.gstatic.com' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Because of this the web fonts are not working. I know that if I add Access-Control-Allow-Origin HTTP header it will work. But my site is a Jekyll site and it is hosted in using Github.

So how to add Access-Control-Allow-Origin http header in Jekyll generated site hosted in Github?

like image 742
Karthikeyan Vaithilingam Avatar asked Aug 29 '14 18:08

Karthikeyan Vaithilingam


2 Answers

Font in gstatic.com are served with Access-Control-Allow-Origin:* header. As stated here, it can be a proxy problem.

One thing is sure, you can't set this header yourself on Github pages.

like image 77
David Jacquel Avatar answered Nov 01 '22 22:11

David Jacquel


This is an answer to an old question, but hopefully it will help someone.

If you are accessing Google Maps API or Fonts using http, try using the https version instead.

like image 41
Justin Nafe Avatar answered Nov 01 '22 22:11

Justin Nafe