【问题标题】:Using apache web server proxy to apache tomcat使用 apache web 服务器代理到 apache tomcat
【发布时间】:2015-11-23 10:12:28
【问题描述】:

根据apaches 文档,wstunnel 是在 2.4 中添加的,我应该能够路由流量。

我有以下设置

Apache tomcat 在 8081 和 8444 上运行。

Tomcat 提供静态文件 (html/js) 和 groovy/grails (war) 文件

我已代理 8081 <- 808444 <- 443

意思是我可以去http://domain/app 看看我必须去http://domain:8081/app 看看。 [这工作得很好]

但是,在静态 javascript/html 页面中,有一个使用 websocket 返回到 tomcat 的连接。我的应用尝试连接回名为 inf 的应用,但失败了。

此代理/连接失败。

我在日志中看到 httpd (apache) 无法找到 /inf/stomp/getInfo 的正确协议,这是后端 websocket 的 url

我已尝试遵循this posts 注释以及this post 中提到的正确顺序

httpd.conf

Listen 443
ServerName mydomain
<VirtualHost *:443>

<Proxy *>
      Order deny,allow
      Allow from all
</Proxy>

SSLEngine On
SSLProxyEngine On
SSLCertificateFile /etc/httpd/ssl/ssl.crt
SSLCertificateKeyFile /etc/httpd/ssl/ssl.key
RequestHeader set Front-End-Https "On"
SSLProxyEngine on
SSLProxyVerify none 
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
LogLevel debug


ProxyPass /mainView https://mydomain:8443/mainView
ProxyPassReverse /mainView https://mydomain:8443/mainView

ProxyPass /cas https://mydomain:8443/cas
ProxyPassReverse /cas https://mydomain:8443/cas

# <not working as it should>
ProxyPass /inf/ ws://mydomain:8081/inf/
ProxyPassReverse /inf/ ws://mydomain:8081/inf/
# </not working as it should>

ProxyPass /inf/ wss://mydomain:8444/inf/
ProxyPassReverse /inf/ wss://mydomain:8444/inf/



ProxyPass /inf-app https://mydomain:8444/
ProxyPassReverse /inf-app  https://mydomain:8444/
</VirtualHost>

【问题讨论】:

    标签: apache tomcat proxy websocket stomp


    【解决方案1】:

    您是否意识到您有两个: ProxyPass /inf/ 块,如果您同时拥有安全和不安全的虚拟主机,则需要将 ws: 版本移动到端口 80 虚拟主机。还有一个重复的 SSLProxyEngine on

    关于解决您的问题,请参阅:tunneling secure websocket connections with apache,尤其是:--enable-proxy_wstunnel=shared 文本

    【讨论】:

      猜你喜欢
      • 2010-11-10
      • 1970-01-01
      • 1970-01-01
      • 2015-06-06
      • 2013-05-22
      • 2013-08-28
      • 1970-01-01
      • 2017-04-19
      • 1970-01-01
      相关资源
      最近更新 更多