6

Does anyone know how can i proxy wss connection to ws?

For example:

ProxyPass "wss://" "ws://"

mspapant
  • 1,860
  • 1
  • 22
  • 31

1 Answers1

4

The solution is to use rewrite rules:

 RewriteEngine On
 RewriteCond %{HTTP:Upgrade} =websocket
 RewriteRule /(.*)           ws://localhost:9001/api/$1 [P,L]
 RewriteCond %{HTTP:Upgrade} !=websocket
 RewriteRule /(.*)           http://localhost:9001/api/$1 [P,L]
mspapant
  • 1,860
  • 1
  • 22
  • 31
  • I have no idea why did I have to do this, but it really did work. I'm using a digitalocean ubuntu 16.04 LAMP stack droplet, and uploaded an example from the Ratchet php tutorial and it simply did not work until I added this part into my virtualhost definition, after literally trying everything for 12 hours straight. Thank you! – Sevron Jan 08 '17 at 22:43
  • 1
    Doesnt work for me. I have my node websocket(ws) running over 5000. I want to route ws requests to wss – cyberrspiritt Sep 27 '17 at 11:27