gpt4 book ai didi

apache - 使用 apache web 服务器代理到 apache tomcat

转载 作者:行者123 更新时间:2023-11-28 22:02:11 28 4
gpt4 key购买 nike

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

我有以下设置

运行在 8081 和 8444 上的 Apache tomcat。

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 找到正确的协议(protocol)这是后端 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>

最佳答案

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

关于解决您的问题,请参阅:tunneling secure websocket connections with apache ,特别是:--enable-proxy_wstunnel=shared text

关于apache - 使用 apache web 服务器代理到 apache tomcat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32276302/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com