我有一个CloudFront分配与自定义来源ELB(与EC2实例)连接。 当执行请求curl https://xxx.cloudfront.net/atlassian-connect.json一个HTTP/1.1 502 Bad Gateway响应。
HTTP/1.1 502 Bad Gateway Content-Type: text/html Content-Length: 587 Connection: keep-alive Server: CloudFront Date: Sun, 29 May 2016 14:32:18 GMT Age: 23 X-Cache: Error from cloudfront Via: 1.1 fb7ff691963d3e3600808dccbe4422d2.cloudfront.net (CloudFront) X-Amz-Cf-Id: HymCU2TweM0e6O4bDhluvDOj0gd2BoAqCnDtVyTOZBz2wOIYHN-Qhg==
当发送请求(绕过CloudFront分配)直接到ELB时,我能够得到预期的响应:
curl -kv https://xxx.eu-central-1.elb.amazonaws.com/atlassian-connect.json
试图调整一些云端分布选项后,我无法让它工作。
您的服务器上的SSL证书在此configuration中不可用。
您正在绕过curl进行validation,但CloudFront(足够明智)没有提供这种旁路机制。
如果将Host:标题列入白名单以便转发到源,则您的证书必须与原始请求中的原始Host:名或 Host:标头匹配。
如果您的证书不包含与“主机”标头中的“起始域名”或“域名”匹配的任何域名,则CloudFront会向查看器返回HTTP状态码502(错误网关)。
…并且必须是最新的,有效的,而不是自签名的,并且具有适当构build的信任链:
如果源服务器返回过期证书,无效证书或自签名证书,或者源服务器以错误顺序返回证书链,则CloudFront将丢弃TCP连接,返回HTTP错误代码502,并设置X-将标题caching到来自cloudfront的错误。
引用来自http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/SecureConnections.html 。