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.
- I have added the public IPv4 DNS to Cloudfront's origin Domain Name.
- 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)
- The security group is configured with all ports open. (So this should not be a problem I guess.)
- 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).
- Is it fine to use the public DNS of the ec2 to connect it to cloudfront on temporary basis?