0

I just put my first Wordpress site up on a EC2 instance. And I have setup CloudFlare as my CDN. But when viewing the site I get the error below:

Font from origin 'EC2 IP' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'SITE DOMAIN' is therefore not allowed access.

I have modified the .httpd file on my EC2 instance to allow all font types. But still no luck.

What am I overlooking to get the header to have access.

  • 1
    Is there a reference to the font resource that uses the IP instead of the domain name? If so, is there a reason for this or is it just a mistake? – Håkan Lindqvist Aug 12 '15 at 21:55
0

In Wordpress you set your site address. In the current configuration it was set to the IP of the server. After changing it to the domain name it fixed my issue.

0

If you are running your site on an Apache server try adding the following to your .htaccess file:

<IfModule mod_headers.c>
<FilesMatch "\.(svg|ttf|otf|eot|woff|woff2)$">
    Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>

This will allow the fonts to be accessed from any domain, not just your site domain.

  • Also refer to the following issue here – Thomas Jan 8 '16 at 4:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.