0

I have attached EC2 instance with application load balancer. My EC2 instance running react js app on PORT 80 where as the NODE JS APIs are running on PORT 3000. I want to run APIs with domain name instead of IP address

Below is my registered targets -

ALB registered targets

Update - Following are my application and instance details -

  1. EC2 - Ubuntu 18.04 + Apache web server
  2. Front end - working fine on port 80 (https://www dot mydomain dot com)
  3. API - written in NODE JS, running on PORT 3000 (so basically I am trying to run https://www dot mydomain dot com:3000)

API is running fine with IPv4 http://x.x.x.50:3000

Can anyone please help me to figure out this error? Thank you!

1 Answers1

0

From your question, I understood that your nodejs application running on x.x.x.50:3000. So you will be able to reach your application by hitting http://x.x.x.50:3000

But,

I'm assuming that your request is giving a response when you are hitting like,

example : http://x.x.x.50:3000/data/ or http://x.x.x.50:3000/employee/1

Actual Problem here is, When ELB hit http://x.x.x.50:3000 it would return 404 Status since you don't have an endpoint which is serving for / (Based on my Assumptions about your backend application)

If you've already had a / endpoint, please check what's the Status code it's returning and whether it matches the one which specified in ELB target group

If you check your target Group in AWS, you can see that your expected status Code is 200(by default), if ELB gets any other status code other than 200 it will consider the instance as non-healthy.

Please note that You can change this status code to any code which your health check endpoint returns. Same applicable for health check URL as well.

Sam
  • 4,046
  • 8
  • 31
  • 47