Mobile app version of vmapp.org
Login or Join
Ravi8258870

: 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

@Ravi8258870

Posted in: #Htaccess

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.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Ravi8258870

2 Comments

Sorted by latest first Latest Oldest Best

 

@Jennifer507

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 "*";
}

10% popularity Vote Up Vote Down


 

@Karen161

It seems to be a browser problem. Modern browsers blocks cross domain requests.

Try to use Google Chrome with args.

On Windows: --disable-web-security

On Mac: -disable-web-security

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme