0

I have big problem with setup communication over WSS with my application.

My current configuration:

  • Debian Jessie
  • Apache 2.4.10
  • JS important part

    var c = new WebSocket('ws://my.host.local:1988');

  • Ratchet PHP with server on port 1988

In this case everything works fine. But when I want to add wss there is error:

WebSocket opening handshake was canceled

I've read few old tutorials and I've add changes:

  • enable (a2enmod): proxy proxy_wstunnel

  • change JS part: var c = new WebSocket('wss://my.host.local/wss2');

  • change apache site conf:

 <VirtualHost *:80>  
   ServerAdmin webmaster@localhost  
   ServerName my.host.local
   DocumentRoot /var/www/ws
   
  <Directory /var/www/ws>
   AllowOverride all
   Order allow,deny
   allow from all  
  </Directory>
   
     ProxyRequests off 
     ProxyTimeout 15
     <Proxy *>
       Order deny,allow
       Allow from all 
     </Proxy> 
 
     ProxyPass "/wss2/" "ws://my.host.local:1988/"
</VirtualHost>

After this I still have the same error. When I've changed wss to ws in address it worked but it's very important to enable secure communication. In the future I will use this on https site so new Chrome requires wss.

What I'm doing wrong?

buszito
  • 23
  • 4
  • If you want to proxy encrypted WebSockets to your unencrypted WebSocket server you need to setup your Apache config for SSL. – gre_gor Nov 03 '16 at 18:25
  • This answer: https://stackoverflow.com/questions/17334319/setting-up-a-websocket-on-apache Suggests that the fact that you are connecting over port 1988 could be the issue, is there a firewall blocking that ports connection? *Disclaimer - I'm an absolute novice to WS so I only offer this as a possible solution – Anthony Cregan Jun 20 '17 at 15:26

0 Answers0