I am using https and websocket connection for Laravel project. I have setup virtual host like following:
<VirtualHost *:80>
ServerName test.example.com
ServerAdmin test.example.com
RewriteEngine On
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
</VirtualHost>
<VirtualHost *:443>
ServerAdmin test.example.com
ServerName test.example.com
SSLEngine on
SSLCertificateFile "cert.pem"
SSLCertificateKeyFile "privkey.pem"
SSLCertificateChainFile "chain.pem"
SSLProxyEngine On
ProxyPreserveHost On
ProxyRequests Off
ProxyPass /wss wss://test.example.com:8090/
ProxyPassReverse /wss wss://test.example.com:8090/
DocumentRoot "/var/www/html/laravel/public"
<Directory "/var/www/html/laravel/public">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
But it is showing error in browser:
WebSocket connection to 'wss://test.example.com:8090/' failed: WebSocket opening handshake timed out
Configuration is like following:
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN
6426/systemd-resolv
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
937/sshd
tcp 0 0 {{MY publicIP}}:8090 0.0.0.0:* LISTEN
11576/php
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
19335/mysqld
Can you please help us what can be issue?
Thanks in advance
netstat -tlnporss -tlnpto show what services are listening (and on which ports). That said, you have configured aProxyPassto your server on port8090, it means you want to forward your HTTP(s) request to a known service? Or did you just copy/paste some code from the Internet? – Daniele Santi Jan 17 '19 at 09:44tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 6426/systemd-resolv tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 937/sshd tcp 0 0 {{MY publicIP}}:8090 0.0.0.0:* LISTEN 11576/php tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 19335/mysqld tcp6 0 0 :::80 :::* LISTEN 20439/apache2 tcp6 0 0 :::443 :::* LISTEN 20439/a
– Test User Jan 17 '19 at 10:02wss://test.example.com:8090/Apache won't be concerned as it listen to ports 80 and 443 (not 8090). What your configuration "says" is that IF you're connecting tohttps://test.example.com/(notice the 's', i.e. port 443), THEN Apache will forward your requests towss://test.example.com:8090/. Nothing more. – Daniele Santi Jan 17 '19 at 10:10https://test.example.com/, correct? Also, looks like nothing is listening on ports 80 and 443... looks like Apache is not even started... – Daniele Santi Jan 17 '19 at 10:12https://test.example.com/Is it something an issue with websocket server? – Test User Jan 17 '19 at 10:14