I am trying to serve my node js API (deployed on AWS EC2 and attached with application load balancer) through cloudfront url, is it possible?
Here are the steps I followed so far -
- Created S3 bucket to host static website hosting
- Created cloudfront distribution and linked S3 bucket with it. I can access S3 bucket contents with default url generated from clouddront
- Created custom origin for node js instance
- Created behavior "api/*" to access node js API through cloudfront.
But when I am trying to access API with following url -
http://d3m30a4naen9t2.cloudfront.net/api/getItems
it throws "not found", it's not 404, this response is from EC2 server however the specified route exists.
Can anyone help please?