Home Forums WordPress Plugins Hide My WP Serving Fonts from CDN

This topic is: not a support question
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #11825
    andy1001f
    Post count: 2

    You may run into a problem when using CDN and New theme path e.g /templates. It will display a message error in your console and web fonts won’t load since most browsers flag this for security reasons. Here is a simple workaround to fix this issue.

    Paste this in your .httaccess or httpd.conf file and you’re done.
    For Apache Server
    # BEGIN CORS
    <FilesMatch “.(eot|ttf|otf|woff)”>
    Header set Access-Control-Allow-Origin “*”
    </FilesMatch>
    # END CORS

    For Nginx Server
    # BEGIN CORS
    if ($filename ~* ^.*?\.(eot)|(ttf)|(woff)$){
    add_header Access-Control-Allow-Origin *;
    }
    # END CORS

    Clean your cache on Hard Reload and you’re good to go.

    • This topic was modified 8 years, 11 months ago by andy1001f.
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.