Apache:代理 websocket wss 到 ws

Apache: Proxy websocket wss to ws

有谁知道如何将 wss 连接代理到 ws?

例如:

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

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

 RewriteEngine On
 RewriteCond %{HTTP:Upgrade} =websocket
 RewriteRule /(.*)           ws://localhost:9001/api/ [P,L]
 RewriteCond %{HTTP:Upgrade} !=websocket
 RewriteRule /(.*)           http://localhost:9001/api/ [P,L]