[英]how to redirect traffic from my server to one ip to another ip address in windows firewall
[英]How to redirect only websocket request to another server from apache windows?
我有一个 Apache2.4 配置,它适用于HTTPS
请求。
现在,我试图将wss
(WebSocket) 请求重定向到另一台服务器,它在那里运行(在同一台服务器上,但在端口8000
)。
<VirtualHost *:8080>
ServerAdmin YYYY.YYYY@XXXXX.com
SSLEngine on
SSLCertificateFile "D:/cert/certificate.cert"
SSLCertificateKeyFile "D:/cert/privatekey.key"
# This is how I tried to redirect.
RewriteEngine On
RewriteCond %{HTTP:Connection} Upgrade [NC]
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteRule /(.*) wss://127.0.0.1:8000/$1 [P,L]
我的 WebSocket 网址:
wss://127.0.0.1:8000/ws/home
上面的配置不起作用。 请帮忙!
我点击浏览器https://127.0.0.1:8080/
页面加载了很长时间,屏幕上没有任何响应。
编辑-1:
我通过使用<Location 'path'>
解决了。 谁能帮我处理所有的 WebSocket URL?
我已经使用下面的代码解决了这个问题。
<VirtualHost *:8080>
ServerAdmin YYYY.YYYY@XXXXX.com
SSLEngine on
SSLCertificateFile "D:/cert/certificate.cert"
SSLCertificateKeyFile "D:/cert/privatekey.key"
<Location "/ws/home">
ProxyPass "wss://127.0.0.1:8000/ws/home"
</Location>
但这不适用于所有 WebSocket URL。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.