Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache: Proxy websocket wss to ws

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

For example:

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

like image 981
mspapant Avatar asked Jul 03 '15 17:07

mspapant


1 Answers

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]
like image 121
mspapant Avatar answered Oct 23 '22 09:10

mspapant