Apache 2.2 ProxyPass 与 Weblogic - 无法使用 root

发布于 2024-09-26 16:48:20 字数 385 浏览 1 评论 0原文

我正在尝试配置 Apache 2.2 代理服务器以指向多个 Weblogic 实例。除了一个小问题之外,我在所有事情上都做得很好。

我可以让它工作:ProxyPass /QA http://IP:PORT/

通过转到 http://IP:PORT/QA

但我无法让它工作:ProxyPass / http:// IP:PORT/

通过转到 http://IP:PORT/

我不明白为什么我不能将 ProxyPass 映射到根(/)

I'm trying to configure an Apache 2.2 proxy server to point to multiple Weblogic instances. I'm doing fairly well with everything but a minor point.

I can get this to work: ProxyPass /QA http://IP:PORT/

by going to http://IP:PORT/QA

But I can't get this to work: ProxyPass / http://IP:PORT/

by going to http://IP:PORT/

I don't understand why I cannot have ProxyPass map to the root(/)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

对你再特殊 2024-10-03 16:48:20

我相信 Apache 不允许这样做。这里存在一个潜在的问题,即相互冲突的指令的顺序和优先级;如果您收到 /QA/ 的请求,应该跟在 /QA 匹配还是 / 匹配之后?我想您可能会尝试将多个托管服务器映射到同一地址/端口,而不必识别每个子路径,即单个规则而不是多个规则。与 documentRoot 仍然存在冲突。可以说,如果您在根上进行匹配,那么 Apache 层的意义是什么 - 所有内容都直接通过,并且 Apache 本身不提供任何服务。 (这并不意味着永远没有正当理由这样做,但我可以理解为什么 Apache 可能会这么想)。

我知道执行此操作的唯一方法是在虚拟虚拟主机内(不确定这是否可以在唯一的侦听端口上,但我认为可以):

<VirtualHost *:8080>
    ProxyPass / http://IP:PORT/
    ProxyPassReverse / http://IP:PORT/
</VirtualHost>

您还可以查看 WebLogic 代理插件:

<Location />
    SetHandler weblogic-handler
</Location>

<IfModule mod_weblogic.c>
    WebLogicHost IP
    WebLogicPort PORT
</IfModule>

I believe Apache just doesn't allow it. There's a potential problem here with the order and precedence of conflicting directives; if you get a request for /QA/ should that follow the /QA match or the / match? I guess you might be trying to map multiple managed servers on the same address/port without having to identify each sub-path, i.e. a single rule instead of many. There's still a clash with documentRoot. Arguably, if you're matching on root, then what's the point of the Apache layer - everything is being passed straight through and nothing is being served by Apache itself. (Which doesn't mean there are never valid reasons to do that, but I can see why Apache might think it).

The only way I know to do this is inside a dummy virtual host (not sure if this can be on the only listen port, but I think so):

<VirtualHost *:8080>
    ProxyPass / http://IP:PORT/
    ProxyPassReverse / http://IP:PORT/
</VirtualHost>

You could also look at the WebLogic proxy plug-in:

<Location />
    SetHandler weblogic-handler
</Location>

<IfModule mod_weblogic.c>
    WebLogicHost IP
    WebLogicPort PORT
</IfModule>
德意的啸 2024-10-03 16:48:20

亚历克斯,谢谢你的帮助!

对于尝试设置类似环境的其他人,我已将我所做的内容粘贴在下面。

ProxyRequests OFF

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule headers_module modules/mod_headers.so

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

Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
<Proxy balancer://cluster>
    BalancerMember http://IP:PORT/ route=1
    BalancerMember http://IP:PORT/ route=2
    ProxySet stickysession=ROUTEID
</Proxy>

<VirtualHost *:80>
    ProxyPass / balancer://cluster/
    ProxyPassReverse / balancer://cluster/
</VirtualHost> 

Alex, thanks for your help!

For anyone else out there trying to setup a similar environment, I've paste what I've done below.

ProxyRequests OFF

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule headers_module modules/mod_headers.so

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

Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
<Proxy balancer://cluster>
    BalancerMember http://IP:PORT/ route=1
    BalancerMember http://IP:PORT/ route=2
    ProxySet stickysession=ROUTEID
</Proxy>

<VirtualHost *:80>
    ProxyPass / balancer://cluster/
    ProxyPassReverse / balancer://cluster/
</VirtualHost> 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文