我有一个CloudFront分发 abcd1234.cloudfront.net ,我已经为分发添加了自定义域 mysite.com .

  • The CloudFront distribution's origin: aaabbbccc.execute-api.us-east-1.amazonaws.com

  • 当我加载页面 mysite.com/hello/world 时,CloudFront正在使用API网关 aaabbbccc.execute-api.us-east-1.amazonaws.com/prod/{proxy+}

  • API网关路径 endpoints 正在调用一个Lambda函数,该函数调用类似 getPageContent(customDomainName, pagePath) 的函数,该函数应分别为 mysite.com/hello/world .

  • 但是,在该函数内部,最终使其成为函数 event.headers.Host 值的 Host 标头永远不会是自定义域 . 相反, Host 标头始终是 aaabbbccc.execute-api.us-east-1.amazonaws.com .

I want headers.Host to equal mysite.com (or another header to show that the request comes from mysite.com, but no matter what I do, the Host value is always just the origin url.

编辑:我尝试将网站列入白名单 Host 并导致网站完全破坏,并显示无法访问CloudFront分配的错误 .