amazon-web-services - 如何在 amazon cloudfront 中设置 Cache-Control Header?

标签 amazon-web-services header amazon-cloudfront cache-control pagespeed-insights

我有一个 amazon cloudfront 发行版,它为我的 CDN 创建了一个“来源”。在我的行为中,我设置了最大 TTL、最小 TTL 和默认 TTL。但是我的响应头不会在重定向的静态文件中返回 Cache-control 头。如何设置缓存控制?我需要这个用于谷歌页面洞察

Files to create cache-control

My header responses

最佳答案

正如 所提到的詹姆斯 创建分配时,您在 CF 设置中看到的 MAX TTL、MIN TTL 等定义了 CloudFront 分配和源的缓存行为。换句话说,CloudFront 应在检查源之前将 Assets 保留在边缘站点中的时间。
例如,如果您有一个 S3 存储桶作为源,然后有一个 CloudFront 分配,通过设置 MAX TTL Min TTL 等,您可以告诉 CloudFront 它应该多久检查一次源(在本例中为 S3)以进行更改。
您可以在 AWS Docs 中了解更多信息。 Managing How Long Content Stays in an Edge Cache (Expiration) .

在上面的示例中,您可以转到 S3 存储桶并设置 Cache-Control .有关如何操作的更多信息,请阅读此 one .

关于amazon-web-services - 如何在 amazon cloudfront 中设置 Cache-Control Header?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56187791/

相关文章:

amazon-cloudfront - 有什么方法可以识别来自 CloudFront 的自定义源服务器的请求吗?

c - 访问另一个 typedef 结构中的 typedef 结构

C++:在小项目的头文件中编写整个类的缺点?

android - 在 ListView 中隐藏 Header View

django - 在 AWS Elastic Beanstalk 上部署 Django 应用程序 : Application url shows only "Index of/"

javascript - rails : Jwplayer 7 with cloudfront doesn't work on ios devices because of flash player

google-chrome - 被 CORS 策略阻止的 CORS 策略阻止的 Cloudfront CDN 字体 : No 'Access-Control-Allow-Origin' header is present on the requested resource

ios - 在 AWS 上设置解析服务器时出错

java - 使用 DynamoDBMapper 更新 map 属性中的现有条目

amazon-web-services - 暂停 Elastic Beanstalk 应用程序环境?