简体   繁体   中英

Cloudfront distribution does not work with for an EC2 instance

I'm using an EC2 instance (AWS) to run my server. I've been testing out a few things and want my website and server domains to be HTTPS for a cookie related issue. I was able to add my website (hosted on S3 as of now) on cloudfront to get a secure domain. I tried to do the same with my server URL. However My server is not working on the new Cloudfront URL. I have my webapp on Cloudfront and It's working completely fine on the new generated cloudfront URL.

Details:

  1. I have added the public IPv4 DNS to Cloudfront's origin Domain Name.
  2. The running server is a Node Server. So I try to access it by d7xxxxxxxxx.cloudfront.net:3001 (server is running on port 3001). (But does not respond)
  3. The security group is configured with all ports open. (So this should not be a problem I guess.)

Questions

  1. How can I get my server to work on Cloudfront? The URL is not responding. (The server is working when I access it by the EC2 public DNS).
  2. Is it fine to use the public DNS of the ec2 to connect it to cloudfront on temporary basis?

References

  1. Ref

So I try to access it by d7xxxxxxxxx.cloudfront.net:3001 (server is running on port 3001)

You would only access the CloudFront distribution at ports 80 and 443 . CloudFront doesn't mirror the ports of the origin server, it only serves the default ports for HTTP and HTTPS. You would configure port 3001 in your origin settings within CloudFront as the origin HTTP port.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM