如何为外部字体请求设置 AWS Cloudfront 缓存?

How to Set Up AWS Cloudfront Cache for External Font Request?

我在从远程服务器加载字体时收到此控制台日志错误:

Access to font at 'https://cdn.userway.org/widgetapp/bundles/udf/UserwayDyslexiaFont-Bold-Italic.woff' from origin 'https://www.myWebSite.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

我已经更新了我的网络应用程序以允许使用此字体服务器。现在我需要让我的 CDN AWS Cloudfront 允许它。

AWS 文档有一篇关于此的文章 - How do I resolve the "No 'Access-Control-Allow-Origin' header is present on the requested resource" error from CloudFront?:

Under Cache key contents, for Headers, select Whitelist. From the list of headers, select one of the headers required by your origin. Then, choose Add header. Repeat this step for all the headers required by your origin.

headers 的列表如下所示:

下面是我从 Chrome 开发工具中了解到的有关此资源的 headers 的信息。

我需要从 Headers 列表中 select 做什么,以便我的网站可以加载此字体?

更新

嗯……如果我没看错的话:

https://web.dev/cross-origin-resource-sharing/

...我收到的错误消息来自提供字体的服务器,与我的服务器或 CDN 上的任何设置无关。

对吗?

感谢 AWS 技术支持,答案是:

  • Access-Control-Request-Headers
  • Access-Control-Request-Method
  • 来源