用于代理安全 Websocket 的 HTTPD 配置
我正在开发一个包含在本地网络中的项目。我需要提供从外部访问 LAN 内的 Web 界面的权限。当然,我已经设置了代理并设法访问该界面。
问题是该接口使用网络套接字连接到服务,我找不到好的配置。
一些细节:
- 我无法控制 Web 接口端口
- Websocket 是安全的(wss)
- 所需模块已加载(代理、wstunnel)
这是我的 httpd
Listen IP:443
<VirtualHost *:443>
RewriteEngine On
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} pgrade [NC]
RewriteRule .* wss://backendHostname:PORT/UI$1 [P,L]
SSLProxyEngine On
SSLProxyCheckPeerCN Off
SSLProxyCheckPeerName Off
SSLProxyVerify none
ProxyPreserveHost On
ProxyPass / https://backendHostname:PORT/
ProxyPassReverse / https://backendHostname:PORT/
ProxyRequests off
SSLEngine on
SSLCertificateFile /etc/pki/httpd/httpd.crt
SSLCertificateKeyFile /etc/pki/httpd/httpd.key
</VirtualHost>
我使用重写规则来代理 Websocket 但我仍然得到这个错误
Firefox 无法建立与服务器的连接 wss://ProxyIP/UI_WebSocket?ulc=&size=1920x930&lang=en-US
如果有人遇到正确代理 websocket 的想法
I'm working on a project contained in a local network. I need to provide access to a web interface within the LAN from outside. Naturally I have setup a proxy and managed to access the interface.
The problem is that the interface uses a web socket to connect to a service and I can't find the good configuration.
Some details :
- I don't have control of the web interface port
- The websocket is a secure one (wss)
- Required modules are loaded (proxy, wstunnel)
Here is my httpd
Listen IP:443
<VirtualHost *:443>
RewriteEngine On
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} pgrade [NC]
RewriteRule .* wss://backendHostname:PORT/UI$1 [P,L]
SSLProxyEngine On
SSLProxyCheckPeerCN Off
SSLProxyCheckPeerName Off
SSLProxyVerify none
ProxyPreserveHost On
ProxyPass / https://backendHostname:PORT/
ProxyPassReverse / https://backendHostname:PORT/
ProxyRequests off
SSLEngine on
SSLCertificateFile /etc/pki/httpd/httpd.crt
SSLCertificateKeyFile /etc/pki/httpd/httpd.key
</VirtualHost>
I used the Rewrite rule to proxy the websocket but I still get this error
Firefox can’t establish a connection to the server at wss://ProxyIP/UI_WebSocket?ulc=&size=1920x930&lang=en-US
If anyone got ideas to correctly proxy the websocket
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论