如何使用 weblogic 插件中的 httpd 配置删除应用程序路径

How to remove application path by using httpd config in weblogic plugin

我开发了一个名为 myapp 的 JSF 应用程序部署在名为 mycluster 的同一集群中托管服务器 managedServer1 和 managedServer2 上的 weblogic 12c http 服务器上。可以通过 url http://xx.xx.xx.xx(ip for managedServer1):9080/myapp.

访问应用程序

我尝试通过将 httpd (httpd.conf) 配置为在 weblogic 集群的前端添加一个 apache 负载平衡器 http 服务器:

<VirtualHost *:80>

ServerName www.mywebsite.com.au
ServerAlias mywebsite.com.au

<Proxy balancer://mycluster>
  BalancerMember http://xx.xx.xx.xx1:9080/myapp
  BalancerMember http://xx.xx.xx.xx2:9080/myapp
</Proxy>

ProxyRequests off
ProxyPreserveHost On

<Proxy *>
  Require all granted
</Proxy>

ProxyPass /myapp balancer://mycluster/
ProxyPassReverse /myapp balancer://mycluster/
ProxyPass / balancer://mycluster/
ProxyPassReverse / balancer://mycluster/

<Location />
  Require all granted
</Location>

</VirtualHost>

通过使用此配置,我可以通过 URL

访问我的 jsf 应用程序
http://www.mywebsite.com.au

直接。

不幸的是,由于我的 JSF 应用程序在我的 jsf 页面中有很多 ajax 异步请求,apache 反向代理无法正确处理它,总是导致会话丢失。我必须找到替代方法来满足我的 ajax 请求。

我的Oracle 老乡建议为我的apache http 服务器安装weblogic 插件。安装插件后,我使用以下方法重新配置 httpd.conf:

<VirtualHost *:80>
ServerName www.mywebsite.com.au
<IfModule mod_weblogic.c>
  WebLogicCluster xx.xx.xx.xx1:9080,xx.xx.xx.xx2:9080
  MatchExpression *.xhtml
</IfModule>
<Location /myapp>
  SetHandler weblogic-handler
  Require all granted
</Location>
</VirtualHost> 

不幸的是。我必须通过调用 URL:

来访问我的 JSF 应用程序
http://www.mywebsite.com.au/myapp

我的问题是:是否有其他方法可以将我的虚拟主机配置为从 root 访问我的 JSF 应用程序? (http://www.mywebsite.com.au) 没有应用程序路径。如果是,请指教!

经过几天的努力,想办法解决这个问题,httpd.conf 更新为:

<Location />
  SetHandler weblogic-handler
  PathTrim /myapp
  PathPrepend /myapp
  Require all granted
</Location>

通过使用 PathTrim 和 PathPrepend 来映射 URL。系统现在运行良好。

这个问题可能会帮助其他处于相同情况的人。