Angular 应用中 Font Awesome 字体的 CORS 错误

CORS errors from Font Awesome font in Angular app

运行Angular和Material有一段时间了,突然出现这个问题,把我难住了。我是来自 IntelliJ 的 运行 我的 Angular 应用程序,它开始出现在我的控制台中。

访问“https://fonts.gstatic.com/s/materialicons/v48/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2' from origin 'http://localhost:4200”处的字体已被 CORS 策略阻止:Access-Control-Allow-Headers 在预检响应中不允许请求 header 字段 x-ijt。

我的图标不再显示了。:(

我在这里找到了这个讨论:

https://github.com/google/WebFundamentals/issues/6881

但 Akamai 插件引用的不是 运行。

我也找到了这个讨论,不过好像是nginx相关的。

https://deliciousbrains.com/wp-offload-media/doc/configure-cors-to-resolve-web-font-issues/

我是 运行 Chrome 作为我的 IntelliJ 调试浏览器。

所以,看完后https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000715304-Problem-with-Chrome-plugin-and-CORS

我检查了设置 |构建、执行、部署 |调试器,允许未签名的请求,我的图标又开始工作了。