1

I own an EC2 instance running PHP and Node.js (socket.io), and to allow access, I freed ports 80 (Apache) and 8000 (Node) and everything worked fine (If I access www.mydomain.com the website is normally displayed, and if I access www.mydomain.com:8000/socket.io/socket.io.js the socket.io script is displayed). However, I want to set up an Elastic Load Balancer for this instance (Just for testing, because later I'll use it with Auto Scaling), so I created the Target Group with the following settings:

enter image description here

After that, I registered the instance in Target Group, and the status check worked perfectly:

enter image description here

So, in my Load Balancer (Application Load Balancer and not Classic Load Balancer) I added the following listeners (if I delete the 8000 listener, when I access DNS:8000 or DNS:8000/socket.io/socket.io.js nothing is shown, only the error ERR_CONNECTION_REFUSED):

enter image description here

And in the Security Group of this Load Balancer I also added ports 80 and 8000:

enter image description here

So when accessing the DNS name of Load Balancer it normally shows the website, however, if I try to access the DNS:8000/socket.io/socket.io.js it rewrites the URL to DNS:8000 and continues to show the website, and not the socket.io script. I already tried to add the Path Pattern /socket.io/* to the 8000 listener but it continues the same way. So, how can I do to be able to show the socket.io script?

3

You have one target group that points to port 80 on your instance. You've attached that target group to two listeners.

Instead, you want two target groups that separately register your instance, one that targets 8000 and another for 80. You'll then separately attach those target groups to the 80 and 8000 listeners.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.