Mch*_*eti 1 apache centos node-red
我在装有Cent OS 7.x和Apache 2.4.6 (CentOS)的虚拟机上安装了NodeRed 。
\n\n如果我打开 URL http://10.1.1.1:1880/
,一切正常。我可以部署节点并查看调试。但我需要在特殊位置上使用 Node Red。\n下一步是在我的 httpd.conf 中配置代理通行证。
结果:红色节点可在http://10.1.1.1/nr/
。但几秒钟后我收到以下错误消息。
Lost connection to server, reconnecting in 44s. Try now\n
Run Code Online (Sandbox Code Playgroud)\n\n然后我尝试了相同的操作,还将端口配置添加到 443,\n结果:红色节点可用,https://10.1.1.1/nr/
并且它正在工作几秒钟。然后出现相同的错误消息(+或\xe2\x80\x93几秒钟)
Lost connection to server, reconnecting in 54s. Try now\n
Run Code Online (Sandbox Code Playgroud)\n\n然后我在浏览器中检查了控制台\n错误代码:
\n\nWebSocket connection to 'ws://10.1.1.1/nr/comms' failed: Error during WebSocket handshake: Unexpected response code: 404 a @ red.min.js:16\n
Run Code Online (Sandbox Code Playgroud)\n\n好吧,看来这是 WebSocket 的问题。\n如果有人有一个想法,那就太好了,因为我尝试了不同的解决方案添加了加载模块,但目前还没有真正的想法。一切顺利。
\n\nps:这是我在 httpd.conf 中的代理通行证设置
\n\n<VirtualHost *:80>\n ServerName 10.1.1.1\n RewriteEngine On\n RewriteCond %{REQUEST_URI} ^/socket.io [NC]\n RewriteCond %{QUERY_STRING} transport=websocket [NC]\n RewriteRule /(.*) ws://localhost:1880/$1 [P,L]\n ProxyPass /nr/ http://127.0.0.1:1880/ timeout=360\n ProxyPassReverse /nr/ http://127.0.0.1:1880/\n</VirtualHost>\n
Run Code Online (Sandbox Code Playgroud)\n
小智 5
我是这样做的:
ProxyRequests off
ProxyPreserveHost on
ProxyPass "/comms" "ws://localhost:1880/comms"
ProxyPassReverse "/comms" "ws://localhost:1880/comms"
ProxyPass "/" "http://127.0.0.1:1880/"
ProxyPassReverse "/" "http://127.0.0.1:1880/"
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
Run Code Online (Sandbox Code Playgroud)
这为我解决了这个问题。如果您启用了 TLS,请将 ws: 更改为 wss: