Blog članak

How to Fix CORS Errors for Font Files

Resolve font-loading CORS errors by adding the right Apache headers when assets are served through a CDN or separate domain.

Sam tekst članka trenutačno je i dalje na engleskom, ali hrvatska navigacija, arhiva i povezani sadržaji ostaju dostupni.

You have set the CDN and you have a problem with the fonts, here is the solution.

Apache

Add this block to the .htaccess file and the htaccess.conf file at the very beginning

<FilesMatch ".(eot|otf|ttf|woff|woff2)">
   Header set Access-Control-Allow-Origin "*"
</FilesMatch>

Nginx

Add this block to the virtual host file and restart Nginx:

location ~* .(eot|otf|ttf|woff|woff2) {
   add_header Access-Control-Allow-Origin *;
}

Once the additions have been made, it is still necessary to invalidate the files saved on the CDN.

Povezane usluge

Ove su usluge usklađene s temom članka i daju čišći prijelaz od edukativnog sadržaja do konkretne implementacije.

Nastavite čitati

Prvo po zajedničkim kategorijama, a zatim po najjačem preklapanju u tagovima.