[英]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-Control
为must-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可定制的错误代码400
, 403
, 404
, 405
, 414
, 416
, 500
, 501
, 502
, 503
,和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.