将CloudFront与Elastic Beanstalk应用程序连接
我正在尝试将CloudFront与EBS连接。
设置是什么?
ebs托管nodejs应用程序。
CloudFront Origin设置为弹性负载平衡器并接受HTTPS 仅[CloudFront Config]
正确添加了所有替代域。
ACM证书已添加到CloudFront [US EAST -N.VIRGINA]
EC2实例 / EB位于亚太地区。 ACM证书 安装在负载平衡器中也来自亚太地区。
我也在借助Load Balancer听众的帮助下重定向HTTP流量。
安全组允许流量到端口443。 没有AWS WAF设置。
原点设置: -
现在已经一天了。
我正在不断尝试。
我可以设置DNS A& AAA使用路由53记录到CloudFront,也获得下拉值。
我能够直接将域名停放到EBS&他们在HTTPS上正常工作。
获得502错误:无法满足请求。
已经尝试了 https:// /premumsupport/knowledge-center/resolve-cloudfront-bad-request-error/
我怀疑我的ELB是否有来自 Asia Pacific 的ACM证书,但是CloudFront中使用的ACM证书来自 美国东部,这是造成问题的吗?我现在无法更改EBS区域。
I am trying to connect cloudfront with EBS.
Whats the setup?
EBS is hosting a nodeJs application.
Cloudfront origin set to Elastic load balancer and accepts HTTPS
only [Cloudfront config]All Alternative domains are added correctly.
ACM certificate is added to Cloudfront [region US EAST - N.Virgina]
EC2 instance / EBS is in the region Asia Pacific. ACM certificates
installed in load balancer are from Asia pacific too.
I am also redirecting http traffic with the help of load balancer listeners.
Security group allows traffic to port 443 .
No AWS WAF set.
Origin settings:-
It's been a day now.
I am trying continuously.
I am able to set DNS A & AAA record to the cloudfront using route 53, getting the dropdown value as well.
I am able to park domains directly to EBS & they work over https properly.
Getting 502 ERROR : The request could not be satisfied.
Already tried https://aws.amazon.com/premiumsupport/knowledge-center/resolve-cloudfront-bad-request-error/
I doubt my ELB has ACM certificate from Asia Pacific but the ACM certificate used in cloudfront is from US EAST , is that causing the issue? I can't change the EBS region now.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看来您没有。但是您仅使用
https
origin。这就是为什么它不起作用。您必须在HTTP中具有起源,或者实际上在EB上正确设置了HTTP。It seems that you did not setup https on your EB. But you are using
HTTPS only
origin. That's why it does not work. You have to have origin in http, or actually properly setup https on your EB.感谢@Marcin 发现了我愚蠢的错误!
这是因为ELB不接受
配置。
但我设置了侦听器将所有 HTTP 流量重定向到 HTTPS,
HTTPS 流量指向我的实例。
找出@Marcin提到的原因后
我如何解决问题:
将cloudfront原始请求更改为仅http。
设置自定义标头:
我仍然得到相同的响应,发现响应来自缓存。只需要使cloudfront 的缓存失效即可。完成了!
Thanks to @Marcin for finding out my stupid mistake!
It was because of the ELB not accepting
config from cloudfront.
But i had set listeners to redirect all HTTP traffic to HTTPS,
and HTTPS traffic points to my instance.
After finding out the reason mentioned by @Marcin
How i solved the problem:
Changed cloudfront origin request to http only.
Set a custom header :
Still i was getting same response, found out the response was from cache. Just had to invalidate cache of cloudfront. And its done! ????
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html