Question

I'm trying to set up two Apache ProxyPass rules to direct to different Nexus servers. What I want is:

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

and

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

I had it set up to work with our original server, but adding a second rule causes requests for nexus-pro to redirect to the main apache server with /nexus, which then forwards on to the wrong server, thus:

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

I imagine this is something Nexus is doing itself, but I'm not really in control of that.

Here is my current Apache config, what do I need to change?

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

No correct solution

OTHER TIPS

Within a given section, Apache httpd configurations are processed in the order in which they appear in the configuration. If you transpose the two definitions, the more explicit /nexus-pro will override the /nexus definition.

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

Read http://httpd.apache.org/docs/current/sections.html#merging for more information.

You can try these two lines for testing:

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/
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top