使用 Weblogic 代理和 Apache2 将 https 请求重定向到两个不同的 weblogic 服务器
我有一个服务器 serverA,在端口 7001 上运行 weblogic 应用程序 App1,基本 url /app1/,另一个服务器 serverB,在端口 8001 上运行 weblogic 应用程序 App2,基本 url /app2/。两台服务器都运行 Solaris、Apache2 和 Weblogic 9.2
(细节有所更改,但这些具有代表性)
换句话说,可以通过
和 app2
访问 app1 http://serverB:8001/app2/
但是,客户要求对应用程序的所有访问都使用端口 443 上的 https 到 server1。
如果只有一个应用程序,我可以使用虚拟主机,并将以 /app1/ 开头的 URL 的处理程序设置为 Weblogic 代理,该代理会将它们转发到端口 7001 上的服务器 1。
对于两个应用程序,我需要另一个虚拟主机主机与另一个位置语句匹配 /app2/ 并转发到端口 8001 上的当前服务器...但我不明白这是如何工作的,因为第一个虚拟主机将完成 SSL 协商以确定 URL,并且 Apache 大概当事情落到第二个虚拟服务器上时,就无法再这样做了。
那么我该如何处理这个问题呢?
我当前的想法是将所有到达 server1 的 SSL 请求代理到同一服务器 server1 的端口 80(因此本质上只是执行 SSL 终止),然后以上述方式为 /app1/ 和 /app2/ URL 添加两个虚拟主机。
这行得通吗?我是否错过了其他执行此操作的明显方法?
编辑:我想我可能错过了 Weblogic 插件可以有多个块,每个块将页面定向到不同的位置。在这种情况下,这变得很容易。
我明天回来工作后会测试并更新问题
I have a server serverA running a weblogic application App1, with base url /app1/ on port 7001, and another server serverB, running a weblogic application App2, with base url /app2/ on port 8001. Both servers run Solaris, Apache2 and Weblogic 9.2
(details changed, but these are representantive)
In other words, app1 could be accessed on
and app2 on
However, the customer requires that all access to the applications use https on port 443 to server1.
If there was only one application, I could use a virtual host and set the handler for URLS beginning with /app1/ to the Weblogic proxy, which would forward them on to server 1 on port 7001.
With two apps, I would need another virtual host with another Location statement matching /app2/ and forwarding to the current server on port 8001 ... but I don't see how this could work as the first virtual host will have done the SSL negotiation to determine the URL, and Apache presumably can't do that over when things fall through to the second virtual server.
So how do I handle this?
My current idea is to proxy all SSL requests arrving at server1 to the same server server1, on port 80 (so essentially just doing SSL termination), then adding two virtual hosts for the /app1/ and /app2/ URLs in the way described above.
Is this going to work? Have I missed something obvious about other ways of doing this?
EDIT: I think I may have missed that the Weblogic plugin can have several blocks each directing the page to different places. In which case this becomes easy.
I will test tomorrow when back at work and update the question
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
首先,必须阅读的资源当然是官方文档: 安装和配置 Apache HTTP Server 插件(另请参阅此之前的答案,了解有关 WLS 9 插件的更多链接)。
如配置 Apache HTTP Server 部分中详细介绍的插件,我定义了几个
IfModule
,每个应用程序一个(集群或非集群),并且实际上定义了几个VirtualHost
(其中可以包括 <代码>IfModule)。有示例文档:请注意,这是一个基于多个 IP 的虚拟主机配置(而不是文档中所述的基于名称)。但这实际上很好,因为这正是您在使用 SSL 时所需要的,因为您不能使用基于名称的虚拟主机。引用 为什么我不能将 SSL 与基于名称/非 IP 一起使用基于 -based 的虚拟主机? 来自 Apache 的 SSL/TLS 强加密:常见问题解答
因此,在上面的示例中,修改虚拟主机 IP 地址和端口、
ServerName
,调整 IfModule 以满足您的需求(并设置 DNS 条目以指向 IP),然后就可以了。First, the must read resource for this is of course the official documentation : Installing and Configuring the Apache HTTP Server Plug-In (see also this previous answer for more links about the WLS 9 plugin).
As detailed in the section Configuring the Apache HTTP Server Plug-In, I'd define several
IfModule
, one for each application (clustered or not), and, indeed, severalVirtualHost
(which can includeIfModule
). There is an example in the documentation:Note that this is a Multiple IP-Based Virtual Hosts configuration (and not Name-Based as stated in the documentation). But this is actually good because this is exactly what you need when using SSL as you can't use name-based virtual hosts. Quoting Why can't I use SSL with name-based/non-IP-based virtual hosts? from Apache's SSL/TLS Strong Encryption: FAQ
So, in the sampel above, modify the virtual hosts IP addresses and ports, the
ServerName
, adapt the IfModule to suit your needs (and set up DNS entries to point on the IPs) and there you go.我没有任何 weblogic 的经验,所以也许我错过了一些重要的东西。但这听起来像是 apache 反向代理功能的一个简单应用程序。设置一个服务 https 的 apache 实例,并配置两个位置,如下所示:
I don't have any experience with weblogic, so maybe I'm missing something important. But this sounds like a straightforward application for apache's reverse proxy capability. Set up an apache instance serving https, and configure two locations as follows:
WebLogic 10.3.x 文档中的示例配置 非常适合您的问题。这里添加了一些其他细节:
我使用它并且工作正常。
The example config from the WebLogic 10.3.x documentation is a perfect fit for your question. Here it is with some other details added:
I use this and works fine.