Reputation: 4776
I have built a Websocket on Ubuntu 20.04 (LAMP) stack using Ratchet.
I followed this article https://www.twilio.com/blog/create-php-websocket-server-build-real-time-even-driven-application to build the websocket.
I Followed this article Does an Application Load Balancer support WebSockets? to configure my webserver.
Apache configuration
<VirtualHost *:80>
ServerName chat.domain.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/websites/chat.domain.com/public
<Directory /var/www/websites/chat.domain.com/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/chat.domain.com/error.log
CustomLog ${APACHE_LOG_DIR}/chat.domain.com/access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerName chat.domain.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/websites/chat.domain.com/public
<Directory /var/www/websites/chat.domain.com/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ProxyPass / https://chat.domain.com:8080/
ProxyPassReverse / https://chat.domain.com:8080/
<Location "/">
ProxyPass "wss://chat.domain.com:8080/"
</Location>
ErrorLog ${APACHE_LOG_DIR}/chat.domain.com/error.log
CustomLog ${APACHE_LOG_DIR}/chat.domain.com/access.log combined
</VirtualHost>
Every thing is in place and running but I get
WebSocket connection to 'wss://chat.domain.com:8080/' failed:
Here is my chrome inspect
I have even tried to Open traffic to ALL ports (Inbond) just to check the security group but still getting the same error.
I doubt the problem is configuring Load Balancer, Security Group and Target group?
Any help or suggestion?
Upvotes: 1
Views: 343
Reputation: 4776
Finally I found the solution. The port 8080 should have been added to firewall and I had to create a new target group for port 8080 which then I had to create a load balancer with port http:8080 and point to the target group.
Upvotes: 0