Mentre lavoravo in locale, tutto ha funzionato perfettamente, ora ho caricato su un hosting e i font sono stati bloccati da qualcosa che non ho mai sentito nominare (CORS). I caratteri (e css, js, ecc.) Sono in un sottodominio perché gli URL vengono analizzati dall'indice (quindi i percorsi non funzionano nel dominio). I css/j stanno funzionando bene.sono bloccati nel client web cors
Questa è l'uscita nella console web (Firefox):
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at /fonts/Oxygen-Regular.ttf. (Reason: CORS header 'Access-Control-Allow-Origin' missing). <unknown>
downloadable font: download failed (font-family: "Oxygen-Regular" style:normal weight:normal stretch:normal src index:0): bad URI or cross-site access not allowed source: /fonts/Oxygen-Regular.ttf styles.css:10:12
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at /fonts/Montserrat-Regular.ttf. (Reason: CORS header 'Access-Control-Allow-Origin' missing). <unknown>
downloadable font: download failed (font-family: "Montserrat-Regular" style:normal weight:normal stretch:normal src index:0): bad URI or cross-site access not allowed source: /fonts/Montserrat-Regular.ttf styles.css:6:12
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at /fonts/glyphicons-halflings-regular.woff2. (Reason: CORS header 'Access-Control-Allow-Origin' missing). <unknown>
downloadable font: download failed (font-family: "Glyphicons Halflings" style:normal weight:normal stretch:normal src index:1): bad URI or cross-site access not allowed source: /fonts/glyphicons-halflings-regular.woff2 bootstrap.css:267:12
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at /fonts/glyphicons-halflings-regular.woff. (Reason: CORS header 'Access-Control-Allow-Origin' missing). <unknown>
downloadable font: download failed (font-family: "Glyphicons Halflings" style:normal weight:normal stretch:normal src index:2): bad URI or cross-site access not allowed source: /fonts/glyphicons-halflings-regular.woff bootstrap.css:267:12
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at /fonts/glyphicons-halflings-regular.ttf. (Reason: CORS header 'Access-Control-Allow-Origin' missing). <unknown>
downloadable font: download failed (font-family: "Glyphicons Halflings" style:normal weight:normal stretch:normal src index:3): bad URI or cross-site access not allowed source: /fonts/glyphicons-halflings-regular.ttf bootstrap.css:267:12
Ho cercato per questo problema, ma non riesco a trovare questo problema especific con font e il messaggio di errore esatto.
EDIT:
La correzione è quello di consentire l'intestazione per il dominio/cartella di servire i file. La configurazione può essere nel blocco host virtuale o in un file .htaccess (nella cartella in cui si trovano i file). Io preferisco l'impostazione nel blocco vhost:
<IfModule mod_headers.c>
SetEnvIf Origin "https://(www|sub1|sub2|sub3).domain.com)$" ACAO=$0
Header set Access-Control-Allow-Origin "%{ACAO}e" env=ACAO
Header set Access-Control-Allow-Methods "GET"
</IfModule>
In questo esempio, il Access-Control-Allow-Origin
invierà solo l'intestazione del dominio autorizzato e sottodomini. Devio reindirizzare da domain.com
a www.domain.com
quindi questo esempio non accetterà un dominio senza www
.
solo Google come impostare l'intestazione menzionato con il tuo web server e hai finito – Marged
Scusa, quale colpo di testa? È la prima volta che ho questo problema e mi sono perso :( –
Access-control-allow-origin, è mostrato nel messaggio di errore. Dai un'occhiata a enable-Cors.org o usa il tuo motore di ricerca preferito – Marged