http - 取消状态阻止字体下载

标签 http fonts request-cancelling

我有一个包含一些文本的页面,该页面已被赋予构成字体系列:

enter image description here

此字体是从一家类型转换厂下载的,并为带有@font-face 的页面定义: enter image description here

当页面呈现时,浏览器会寻找字体,但请求被取消阻止,并且文本没有应用字体系列:

enter image description here

有谁知道可能导致此取消的原因是什么?这曾经有效,我无法想象我做了什么或发生了什么破坏了它。

感谢您的帮助。

最佳答案

Access-Control-Allow-Origin header 只需要一个来源或通配符 (*)。

您在问题评论中提到的错误(“'Access-Control-Allow-Origin' header 包含多个值......但只允许一个值”)清楚地表明 Access- 中有多个值Control-Allow-Origin header ,或者有多个 Access-Control-Allow-Origin header 。

要解决此问题,应该只有一个 Access-Control-Allow-Origin header ,只有一个原始值。


如问题中所述:“这曾经有效”。我猜这个问题是由于在服务器配置中不小心添加了额外的 Access-Control-Allow-Origin header 引起的。


作为引用,请查看 W3C specification :

A resource can have one Access-Control-Allow-Origin header defined. The header must match the following ABNF:

Access-Control-Allow-Origin = "Access-Control-Allow-Origin" ":" ascii-origin | "*"

ascii-origin = ASCII serialization of an origin

关于http - 取消状态阻止字体下载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44876249/

相关文章:

http - 用于根据 HTTP 1.1 规范验证 HTTP 服务器/客户端的框架

c# - 如何暂停 BackgroundWorker?或者类似的东西

apache - 我可以在商业发行的游戏中使用 Apache License 2.0 下的字体吗?

html - @font-face src 导致字体系列崩溃

css - 找不到 woff 和 ttf 字体 404

http - 已取消请求的正确 HTTP 状态代码是什么

c# - 如何取消深度嵌套的进程

http - 如何使用 golang 服务器检查隐式设置的 http header ?

php - 通过 Angular 6 将查询字符串中的数组发送到 PHP

angular - "_this.http is undefined"无缘无故