: Access-control-allow-origin not working? I've seen similar questions asked here but I am still unable to solve this issue. I'm running Typekit and FontAwesome (from CDN) and I get the following
I've seen similar questions asked here but I am still unable to solve this issue. I'm running Typekit and FontAwesome (from CDN) and I get the following error
XMLHttpRequest cannot load resource.com/example/example. Origin mydomain.com is not allowed by Access-Control-Allow-Origin.
Now, the typekit font and fontawesome css stylesheet are loading perfectly fine, so I'm not sure why the error :
I have already tried to setup CORS through .htaccess but even then I still get the error. Does anyone have a recommendation for this problem?
This is happening in both, my local and production server.
More posts by @Ravi8258870
2 Comments
Sorted by latest first Latest Oldest Best
Commonly you need to define CORS on your server if you want to allow 3rd party URLs to load other assets. Just check the following configuration examples where you set the CORS header to allow everything (*). Just replace the * with the desired domain if you want to be restrictive.
Apache
<IfModule mod_headers.c>
<FilesMatch ".(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>
Nginx
location ~ .(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$ {
add_header Access-Control-Allow-Origin "*";
}
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.