Apache:代理websocket wss到ws

msp*_*ant 5 apache wss websocket

有谁知道我怎么能代理wss连接到ws?

例如:

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

msp*_*ant 4

解决方案是使用重写规则:

 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]
Run Code Online (Sandbox Code Playgroud)