Richard Vergis
Richard Vergis

Reputation: 1057

Application Load Balancer https request to EC2 nodejs running on port 3000

I have an ALB that is in HTTPS that will request to my EC2 instance.

I configured the ALB listeners to HTTP/HTTPS then target my EC2.

When I try to access my ALB with these:

  1. https://domainSample Response = Welcome to nginx

  2. https://domainSample/api/getSample Response = 404 Not Found nginx

  3. https://domainSample:3000 No Response

This is my nginx configuration in EC2 that runs on port 3000

 server {

            listen 80;
            server_name domainSample;

            location / {
                    try_files $uri $uri/ =404;
            }
  }

Where did I go wrong?

Upvotes: 0

Views: 1574

Answers (1)

Richard Vergis
Richard Vergis

Reputation: 1057

I have search and read about the documentation on AWS and do some tweek and test to the application.

What I understand in the flow of the request from the ALB to EC2.

In configuring the ALB, In Target Groups, we need to set the target of its request which will be the EC2 that your application is running on to.

For instance, we have Node js running on to port 3000 in the EC2. We will add the target instance which we specify the port on 3000.

This solved my problem. Thanks

Upvotes: 1

Related Questions