0

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

  • Hello and welcome to Ask Ubuntu! Can you share the configuration of whatever is listening on port 8090 ? – Mr Shunz Jan 17 at 9:30
  • Yes, but how can I know what is listening to 8090, any command? – Test User Jan 17 at 9:36
  • Please check with netstat -tlnp or ss -tlnp to show what services are listening (and on which ports). That said, you have configured a ProxyPass to your server on port 8090, 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? – Mr Shunz Jan 17 at 9:44
  • I copied and pasted the code. Actually I do not want to redirect to any. I am directly making connection using url 'wss://test.example.com:8090/'. It was working fine with http means if I reomove configuration for ssl(443) then it is working well. – Test User Jan 17 at 9:59
  • 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 tcp6 0 0 :::80 :::* LISTEN 20439/apache2 tcp6 0 0 :::443 :::* LISTEN 20439/a – Test User Jan 17 at 10:02

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.