简体   繁体   English

当Apache HTTPD在Tomcat前面时,WebSocket连接中断

[英]WebSocket connection interrupted when Apache HTTPD in front of Tomcat

I try to use Tomcat implementation of WebSockets on local machine. 我尝试在本地机器上使用Tomcat实现WebSockets。 When I use only tomcat everything works fine, but when I start use bundle Apache + mod_jk + Tomcat browser show me 'The connection to ws://example.com/test/echoMessage was interrupted while the page was loading' after couple of seconds of work. 当我只使用tomcat一切正常时,但是当我开始使用bundle Apache + mod_jk + Tomcat浏览器显示'连接到ws://example.com/test/echoMessage在页面加载时被中断了几秒钟工作的。 WebSocket connection is closed after this. 此后WebSocket连接将关闭。

Can anyone tell me how to fix it? 谁能告诉我如何解决它?

I have: Apache HTTPD 2.2.18, mod_jk 1.2.37, Tomcat 7.0.28 我有:Apache HTTPD 2.2.18,mod_jk 1.2.37,Tomcat 7.0.28

Here is server side code that I use: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/ and client side: http://svn.apache.org/viewvc/tomcat/trunk/webapps/examples/websocket/ 这是我使用的服务器端代码: http//svn.apache.org/viewvc/tomcat/trunk/webapps/examples/WEB-INF/classes/websocket/和客户端: http//svn.apache.org / viewvc / Tomcat的/中继/ web应用/实施例/网页套接字/

Browsers: Firefox 12, Chrome 19 浏览器:Firefox 12,Chrome 19

I would research whether Apache mod_proxy is able to transparently forward traffic at the TCP level at all. 我将研究Apache mod_proxy是否能够透明地转发TCP级别的流量。 Since that is likely needed for WebSocket to pass through. 因为WebSocket可能需要通过它。 IOW: is mod_proxy able to transparently reverse proxy WebSocket traffic? IOW:mod_proxy是否能够透明地反向代理WebSocket流量?

But why would you want to bring Apache in the line anyway? 但是你为什么还要把Apache带入生产线呢? It doesn't add any value, only more parts which can break. 它不会添加任何值,只会添加更多可能会破坏的部分。 That is for WebSocket of course .. 那当然是WebSocket ..

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM