mitsuki
mitsuki

Reputation: 29

CloudFront to EC2 origin returns a 502 error. How can I investigate?

When I tried to connect cloud front to EC2, I can see the following error. I set ec2-XXX-XXX-XXX-XXX.us-west-2.compute.amazonaws.com to "origin domain name and path" on Cloud front. What is wrong?

502 ERROR The request could not be satisfied. CloudFront attempted to establish a connection with the origin, but either the attempt failed or the origin closed the connection. We can't connect to the server for this app or website at this time.

There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.

If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.

I am looking forward to your reply. :)

Upvotes: 1

Views: 2014

Answers (1)

Chris Williams
Chris Williams

Reputation: 35258

A 502 error for CloudFront will come down to a number of issues:

  • If CloudFront is trying to connect to the origin over HTTPS validate your SSL, is it valid for the origin(s) domain. Use SSL Labs if you want to validate.
  • Are these ports open to CloudFront? You'll need to make sure CloudFront can connect publically to your instance. If it's connecting via a private IP address it won't work, and if you are restricting the ports to a specific IP address it will also not work.

You can read more about the reasoning behind the 502 for CloudFront from the AWS documentation here.

Any further question let me know.

Upvotes: 0

Related Questions