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.
- Configured Security Group - Inbound rules TCP 8080
- Configured Load balancer
- Created Target group (TCP) for port 8080
- Enabled Stickyness (1 hour)
- SSL is configured and created in AWS Certificate Manager
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?