Cloudfront 中的白名单授权 header

whitelist Authorization header in Cloudfront

我在 PHP EC2 服务器上使用 OAuth2。

从我托管在 S3 中的前端客户端,我正在向我的 ElasticBeanstalk EC2 服务器发出请求(前端和后端都通过带有 SSL 证书的 Cloudfront 提供服务)。

这些请求与所需的访问令牌一起发送 header 作为 Authorization: header ...

Cloudfront 似乎删除了这些 headers,因为我收到错误:

error_description: "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Check the "access token" parameter."

我正尝试按照 this documentation 的指示通过 Cloudfront "whitelist" 此 header,但发现它非常混乱。我实际上可以在 Cloudfront 的哪个位置添加 Authorization header 接受?

部分文档说:

You can configure each cache behavior in a web distribution to do one of the following:

  • Forward all headers to your origin

但是我在设置的时候已经这样做了:

你需要明确 whitelist headers 你想要的,否则选择 None (Improves Caching) 条带 headers 需要: