Font from subdomain has been blocked by Cross-Origin Resource Sharing Policy

I’m having the following error Font from origin ‘http://static.example.com‘ has been blocked from loading by Cross-Origin Resource Sharing policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://www.example.com‘ is therefore not allowed access.

I am using the following COR setting in .htaccess file here below

Read More
<IfModule mod_expires.c>
  ExpiresActive on
  ExpiresDefault "access plus 1 month"
  ExpiresByType text/cache-manifest "access plus 0 seconds"

  ........

  <IfModule mod_headers.c>
     Header append Cache-Control "public"
     <FilesMatch ".(ttf|otf|eot|woff|svg)$">
       SetEnvIf Origin "^http://(.*)?example.com$" origin_is=$0
       Header set Access-Control-Allow-Origin %{origin_is}e env=origin_is
     </FilesMatch>
     <FilesMatch ".(js|css|xml|gz)$">
       Header append Vary: Accept-Encoding
     </FilesMatch>
  </IfModule>
</IfModule>

Please I need help with this

Related posts

Leave a Reply

3 comments

  1. Try adding this to your .htaccess file:

    Header add Access-Control-Allow-Origin "http://example.com"
    

    Alternative:

    Header add Access-Control-Allow-Origin "*"