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:
After that, I registered the instance in Target Group, and the status check worked perfectly:
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
):
And in the Security Group of this Load Balancer I also added ports 80 and 8000:
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?