CloudFront - 如何将所有请求 headers 转发到源

CloudFront - How to forward all request headers to the origin

在 CloudFront 行为设置中,"All" 是否将所有请求 headers 转发到源?

If you configure CloudFront to forward all headers to your origin for a cache behavior, CloudFront never caches the associated objects. Instead, CloudFront forwards all requests for those objects to the origin. In that configuration, the value of Minimum TTL must be 0.

是的,是的。

文档似乎更多地关注基于 headers 的缓存而不是转发的内容,但是缓存 headers 并将 headers 转发到原点 go hand-in-hand.

当我从文档中寻找明确的引用时,我在 Amazon CloudFront 开发人员指南 中找到的一个参考资料如下所示。它是标题为 "Cache Based on Selected Request Headers" 的部分的 link,但其锚标记是 DownloadDistValuesForwardHeaders

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesForwardHeaders

这表明有人试图澄清或简化文档...但显然收效甚微。

请注意,这会将 几乎 所有 header 转发到源,除了一些仍然 stripped 安全 and/or 操作原因,例如 X-Forwarded-ProtoX-Real-IPX-Edge-*.

另请注意,如果您的源协议是 HTTPS,并且您尚未在 CloudFront 将 Host header 列入白名单,那么将所有 header 列入白名单可能会改变对来源的 TLS 证书。未能正确处理此问题是 CloudFront 可能 return 对查看者 502 error 的几个原因之一。