是否可以使用AWS CloudFront来代理Google字体?

发布于 2025-01-24 15:00:20 字数 927 浏览 0 评论 0 原文

我创建了一个AWS CloudFront发行版,以尝试通过CloudFront向fonts.googleapis.com代理请求。因此,例如,我想使用以下列表:

https://xxxxxx.cloudfront.net/css2?family=noto+sans+hk:wght@400; 500; 700; 700 ;900 ;900&ampplay=swap

以获取fetth来自原点的实际内容:

https://fonts.googleapis.com/css2?family=

noto++sans+hk:wght@400上.googleapis.com“并设置它,以使其通过所有URL参数,但是原始问题仍然响应:

404. That’s an error.
The requested URL /css2 was not found on this server.

有人知道可能导致这一点吗? Afaik,我配置的CloudFront的方式应该像透明的通行证一样。

我不能在这里共享所有云沿配置设置(太多),但是也许有人可以将我指向正确的方向?

还是不可能?

I have created an AWS Cloudfront distribution in an attempt to proxy requests to fonts.googleapis.com through Cloudfront. So for example, I'd like to use something list this:

https://xxxxxx.cloudfront.net/css2?family=Noto+Sans+HK:wght@400;500;700;900&display=swap

To fetch the actual content from the origin at:

https://fonts.googleapis.com/css2?family=Noto+Sans+HK:wght@400;500;700;900&display=swap

I have configured Cloudfront with an origin of "fonts.googleapis.com" and set it so that it passes through all URL parameters, but still the origin responds with:

404. That’s an error.
The requested URL /css2 was not found on this server.

Does anyone know what could be causing this? Afaik, the way I've configured Cloudfront should act like a transparent pass-through.

I can't share all of the Cloudfront config settings here (there are too many), but perhaps someone can point me in the right direction?

Or is this impossible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

撑一把青伞 2025-01-31 15:00:20

实际上,这确实很好。我刚刚设置了云的分布。

This in fact did work fine. I had just setup the CloudFront distribution incorrectly.

恬淡成诗 2025-01-31 15:00:20

我怀疑所指的更改是要更新行为,以防止原点请求发送主机标头。创建一个缓存策略,从原始请求中删除主机标头,一切都会为您神奇起作用。

I suspect the change OP referred to was to update the behavior to prevent the origin request from sending the host header. Create a cache policy, remove the host header from the origin request and everything will work magically for you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文