简体   繁体   English

CloudFront是否在来自原点的错误响应(例如503)中使用Cache-Control标头?

[英]Does CloudFront make use of Cache-Control headers in error responses (e.g. 503) from the origin?

Does CloudFront make use of Cache-Control headers (eg max-age ) in error responses (eg 503 ) from the origin? CloudFront是否在来自原点的错误响应(例如503 )中使用Cache-Control标头(例如max-age )? Or is the length of its caching of error responses always controlled by the Error Caching Minimum TTL configured on the distribution? 或者,错误响应缓存的长度总是由分布上配置的错误缓存最小TTL控制? The inclusion of the word "minimum" suggests that the behavior of error caching may be similar to the behavior of non-error caching when the origin provides a Cache-Control max-age , but the documentation on this topic doesn't seem to explicitly confirm that suggestion. 包含“minimum”一词表明,当origin提供Cache-Control max-age ,错误缓存的行为可能类似于非错误缓存的行为,但是关于此主题的文档似乎没有明确说明确认这个建议。

CloudFront does respect Cache-Control max-age headers in error responses from web origins if and when they are greater than the Error Caching Minimum TTL (which has a default of five minutes). 如果CloudFront大于错误缓存最小TTL(默认值为五分钟),则它会在Web来源的错误响应中尊重Cache-Control max-age标头。

If the origin sets a max-age that is less than the Error Caching Minimum TTL, CloudFront caches the response for the Error Caching Minimum TTL but passes the max-age set by the origin on to the client undisturbed. 如果原点设置的max-age小于Error Caching Minimum TTL,则CloudFront会缓存错误缓存最小TTL的响应,但会将原点设置的max-age传递给不受干扰的客户端。

Similarly, if the origin sets Cache-Control to must-revalidate,no-cache,no-store , CloudFront caches the response for the Error Caching Minimum TTL but passes the Cache-Control header set by the origin on to the client undisturbed. 类似地,如果源将Cache-Controlmust-revalidate,no-cache,no-store ,则CloudFront会缓存错误缓存最小TTL的响应,但会将原始设置的Cache-Control标头传递给未受干扰的客户端。

The Error Caching Minimum TTL can be customized for error codes 400 , 403 , 404 , 405 , 414 , 416 , 500 , 501 , 502 , 503 , and 504 . 误差最小缓存TTL可定制的错误代码400403404405414416500501502503 ,和504 It can't be customized for all of the supported error codes at once; 无法同时为所有支持的错误代码进行自定义; it must be customized separately for each error code. 必须为每个错误代码单独定制。 This is done by creating a "Custom Error Response." 这是通过创建“自定义错误响应”来完成的。 Somewhat confusingly, doing so doesn't require that you provide a custom error page. 有点令人困惑,这样做并不要求您提供自定义错误页面。 When creating the Custom Error Response you can select "No" to "Customize Error Response" (that sounds like nonsense, but it's true). 创建自定义错误响应时,您可以选择“否”为“自定义错误响应”(听起来像废话,但这是真的)。 If you do so, you are only customizing the Error Caching Minimum TTL for the HTTP Error Code you select. 如果这样做,则只为您选择的HTTP错误代码自定义错误缓存最小TTL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Origin Cache-Control在AWS Cloudfront上不起作用 - Origin Cache-Control not working on AWS Cloudfront 要从AWS CloudFront删除缓存控制标头吗? - Remove Cache-Control headers from AWS CloudFront? 在 AWS Cloudfront 中如何添加缓存控制? - In AWS Cloudfront how to add cache-control? 来自 AWS CloudFront 的外部 Next.js 图像的缓存控制策略对于 Google Lighthouse 效率不高 - Cache-Control policy for external Next.js Image coming from AWS CloudFront is not efficient for Google Lighthouse 如何在亚马逊云端设置 Cache-Control Header? - How to set Cache-Control Header in amazon cloudfront? AWS Elastic Beanstalk / S3 / CloudFront缓存控制标头 - AWS Elastic Beanstalk / S3 / CloudFront Cache-Control Header AWS-Cloudfront-如何使用起源自定义标头 - AWS - Cloudfront - How To Use Origin Custom Headers Amazon Cloudfront Cache-Control:no-cache 标头在 24 小时后无效 - Amazon Cloudfront Cache-Control: no-cache header has no effect after 24 hours CloudFront回复503错误 - CloudFront replies with 503 error 向所有 S3 文件添加缓存控制和过期标头但防止它们变得不可访问的正确方法? - Correct way to add cache-control and expires headers to all S3 files but prevent them from becoming inaccessible?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM