Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

AWS Load Balancer not working correctly as it is not giving the website view as the EC2 ip and port gives

I wanted to configure two EC2 instances running ExpressJS api server on port 8000 to AWS load balancer.
The Load Balancer DNS gives error "crbug/1173575, non-JS module files deprecated.
(anonymous) @ (index):6583", while the health checks are fine.
The EC2 instance’s ip and port gives the actual result.

I created Target Group, chose target type as ‘instance’, on protocol set it to ‘http’ and port to ‘8000’
Used Health check on the server fetching data from ‘/data?warehouse=Warehouse%201’
Then on the register target page selected both the Available instance and port as ‘8000’

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Then on creating the Load Balancer, chose Application load Balancer, scheme to ‘internet-facing’ , IP Address type to "IPv4", kept the security groups same as EC2 instances.
On Listeners and routing part, chose listener protocol to ‘HTTP’ and set port to ‘8000’ then Forward to ‘target group I created’

Created the Load Balancer in this way.

enter image description here

Now the health check is saying healthy but the DNS is not routing me to the EC2 website page that I get from the EC2 IP and port 8000. It gives error "crbug/1173575, non-JS module files deprecated.
(anonymous) @ (index):6583"
The actual result can be viewed here: http://18.140.239.237:8000/data?warehouse=Warehouse%201
The Load Balancer DNS: http://backendloadbalancer-1996574208.ap-southeast-1.elb.amazonaws.com/data?warehouse=Warehouse%201

>Solution :

Your listener rule needs to listen on port 80 and redirect to the target group on port 8000.

You are instead listening on port 8000 and redirecting on port 8000 too, because accessing to http://backendloadbalancer-1996574208.ap-southeast-1.elb.amazonaws.com:8000/data?warehouse=Warehouse%201 returns the correct response.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading