CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource

Here are some issue we encountered when we are using custom font “woff or ttf”.


Simply go to your .htaccess and add this line.

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

And make sure when you are saving your .htaccess it has the permission and tried to open and reopen it again just to make sure the the code is added.

jQuery error Access-Control-Allow-Origin when sending post request

We encountered weird error when we are requesting to another domain. Actually it is the same domain but on a sub domain.

Here was the error I encountered

I went to my .htaccess and I add this line of code.

Header add Access-Control-Allow-Origin

This will specify the domain you want to allow for security purposes and solve my issue.