更新:看起来像 chrome 中的一个错误:https://code.google.com/p/chromium/issues/detail?id=544879
我们已经有一个网站运行了几年,它的字体托管在 S3 上。它不是 S3 网站,它是私有(private) CDN,我们使用 S3 认证 URL 加载字体。
随着 Chrome 的最新更新,由于 CORS 问题,这已停止工作。
S3 是为这样的 CORS 配置的..
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>Authorization</AllowedHeader>
</CORSRule>
</CORSConfiguration>
这一直有效到 chrome 46.0.2490.7(2 天前发布)。
它现在出错了:
Font from origin 'https://domain.s3-eu-west-1.amazonaws.com' has been blocked from loading by Cross-Origin Resource Sharing policy: A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin 'https://domain.co.uk' is therefore not allowed access.
听起来 Chrome 本身正在添加凭据标志?我找到了这张票 https://code.google.com/p/chromium/issues/detail?id=516192从 8 月开始,听起来他们在 https 相同域请求上强制执行 Credentials 标志,但这是一个 CORS https 请求,所以不应该添加它?
此外,即使我删除 * 并添加域以查看是否修复它,它也会说没有
Access-Control-Allow-Origin
值集,事实并非如此。任何人都知道这是怎么回事,我错过了什么吗?
米
最佳答案
到目前为止,我发现的唯一解决方法是通过同一域服务器代理字体。不理想。
我开了一张票:https://code.google.com/p/chromium/issues/detail?id=544879
关于google-chrome - 最新的 Chrome (46.0.2490.7) 无法通过 https CORS 从 S3 存储桶加载字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33172071/