[英]Error during WebSocket handshake: 'Upgrade' header is missing (Apache 2.4 + mod_proxy_wstunnel)
I have Apache 2.4 running on the server and have setup a subdomain to handle my Node.JS web app which also uses websockets. 我在服务器上运行了Apache 2.4,并设置了一个子域来处理我的Node.JS Web应用程序,该应用程序也使用websockets。
My Apache site config for this is: 我的Apache站点配置是:
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName ws.mysite.io
ProxyPass /ws/ ws://1.2.3.5:6789/
ProxyPassReverse /ws/ ws://1.2.3.5:6789/
ProxyPass / http://1.2.3.5:6789/
ProxyPassReverse / http://1.2.3.5:6789/
</VirtualHost>
So that when users come to http://ws.mysite.io/
- they get served the html from my node.js app (using express) and the html has a javascript part communicating back with the node.js app via websocket on ws.mysite.io/ws/
which is "tunneled" to ws://1.2.3.5:6789/
. 因此,当用户访问
http://ws.mysite.io/
- 他们从我的node.js应用程序(使用快递)获得html,并且html有一个javascript部分通过websocket与node.js应用程序进行通信ws.mysite.io/ws/
是“隧道”到ws://1.2.3.5:6789/
。
I get a situation where on a home wifi - all works. 我得到一个家庭无线网络的情况 - 一切正常。 No problems.
没问题。
At work, we do have firewall, proxy... but i don't know exact limitations or blocks, but what happens is that when i open http://ws.mysite.io/
I get in Chrome console: 在工作中,我们确实有防火墙,代理......但我不知道确切的限制或阻止,但是当我打开
http://ws.mysite.io/
我会进入Chrome控制台:
WebSocket connection to 'ws://ws.mysite.io/ws/' failed: Error during WebSocket handshake: 'Upgrade' header is missing
Is this due to the work proxy "cutting" something off? 这是由于工作代理“削减”了一些东西吗? Is there any chance to set up a "bullet-proof" tunnel to overcome things like that?
有没有机会建立一个“防弹”隧道来克服这样的事情?
As far as I know, you don't need this line: 据我所知,你不需要这一行:
ProxyPassReverse /ws/ ws://1.2.3.5:6789/ ProxyPassReverse / ws / ws://1.2.3.5:6789 /
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.