Apache ProxyPass内部重定向

Apache ProxyPass内部重定向,apache,nexus,proxypass,Apache,Nexus,Proxypass,我正在尝试设置两个Apache ProxyPass规则来指向不同的Nexus服务器。我想要的是: http://mainserver/nexus->http://server1:8080/nexus 及 http://mainserver/nexus-pro->http://server2:8081/nexus 我已将其设置为与原始服务器一起使用,但添加第二条规则会导致nexus pro的请求重定向到带有/nexus的主apache服务器,然后将其转发到错误的服务器,因此: http://mai

我正在尝试设置两个Apache ProxyPass规则来指向不同的Nexus服务器。我想要的是:

http://mainserver/nexus
->
http://server1:8080/nexus

http://mainserver/nexus-pro
->
http://server2:8081/nexus

我已将其设置为与原始服务器一起使用,但添加第二条规则会导致nexus pro的请求重定向到带有/nexus的主apache服务器,然后将其转发到错误的服务器,因此:

http://mainserver/nexus-pro
->
http://mainserver/nexus
->
http://server1:8080/nexus

我想这是Nexus自己在做的事情,但我真的无法控制

这是我当前的Apache配置,我需要更改什么

ProxyPass /nexus http://server1:8080/nexus
ProxyPassReverse /nexus http://server1:8080/nexus

ProxyPass /nexus-pro http://server2:8081/nexus
ProxyPassReverse /nexus-pro http://server2:8081/nexus

ProxyPreserveHost On

在给定的部分中,apachehttpd配置按照它们在配置中出现的顺序进行处理。如果转置这两个定义,则更显式的/nexus pro将覆盖/nexus定义

ProxyPass /nexus-pro http://server2:8081/nexus
ProxyPassReverse /nexus-pro http://server2:8081/nexus

ProxyPass /nexus http://server1:8080/nexus
ProxyPassReverse /nexus http://server1:8080/nexus

ProxyPreserveHost On

阅读了解更多信息。

您可以尝试以下两行进行测试:

ProxyPass /example-ip http://www.toolsvoid.com/what-is-my-ip-address
ProxyPassReverse /example-ip http://www.toolsvoid.com/what-is-my-ip-address

ProxyPass /example http://www.example.com/
ProxyPassReverse /example http://www.example.com/

尝试反转定义。将ProxyPass/nexus pro置于ProxyPass/nexus之前。Apache应该先处理这个问题,但这并没有解决问题-我仍然会被发送到server1上的Nexus服务器。请尝试第二个答案来测试配置。我刚刚证实了这是有效的。确保您正在重新加载httpd配置。Hmmm。。。这会超时,然后给出503。我应该提到我的Apache服务器位于一个代理的后面。我会重做你的例子,但代理内部网站,看看会发生什么。好的,这很好。那么,Nexus在某个时候重定向到/Nexus,导致应用第二个ProxyPass规则的问题是什么呢?