Quantcast
Channel: Active questions tagged amazon-ec2 - Stack Overflow
Viewing all articles
Browse latest Browse all 29253

how to serve node js api through AWS cloudfront?

$
0
0

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 -

  1. Created S3 bucket to host static website hosting
  2. Created cloudfront distribution and linked S3 bucket with it. I can access S3 bucket contents with default url generated from clouddront
  3. Created custom origin for node js instance
  4. 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?


Viewing all articles
Browse latest Browse all 29253

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>