3

I have installed Archiva on my machine under Tomcat 6.x at http://dev.mycompany.com:8080/archiva and can access the application and everything, but I want to access it from the subdomain archiva.mycompany.com.

I have Apache 2.x running on port 80 and using Virtual Hosts and mod_proxy to route from other subdomains to the other various services I am running on this machine.

I now want to create a subdomain archiva.dev.mycompany.com and point that to dev.mycompany.com:8080/archiva.

I can't figure out what I need to put in my ProxyPass and ProxyPassReverse to make this work like I want it to.

I tried the following and all it does is add /archiva to the URL over and over again.

<VirtualHost *:80>
    ServerAdmin me@mycompany.com
    ServerName archiva.dev.mycompany.com
    ProxyPreserveHost On

    <Proxy *>
      Order allow,deny
      Allow from all
    </Proxy>
    ProxyPass / http://dev.mycompany.com:8080/archiva
    ProxyPassReverse / http://dev.mycompany.com:8080/archiva
</VirtualHost>

and I get this error message

HTTP Status 404 - /archivaarchiva/
type Status report
message /archivaarchiva/  
description The requested resource (/archivaarchiva/) is not available.

I went and dug through everything I could find on Google once again and tried the following:

ProxyPass / ajp://dev.mycompany.com:8080/archiva/
ProxyPassReverse / http://dev.mycompany.com:8080/archiva/

now I just get a 404 error code from the Winstone Servlet Engine, I know I am getting close.

Can anyone tell me what magic incantation I need to make this behave as I desire?

2 Answers2

2

I had the exact same problem.

What has to be done :

  • reconfigure archiva to have archiva running on / instead of /archiva/

  • configure reverse proxy in the apache2 configuration.

So now i have "http://repo.[domain]/" for main archiva URL, pointing on "http://[domain]:[port]/"

Here's my current Apache2 configuration :

ProxyRequests Off
ProxyPreserveHost On
<VirtualHost [ip]>

        ServerName repo.[domain]
        ProxyPass / http://[ip]:8082/
        ProxyPassReverse / http://[ip]:8082/

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

</VirtualHost>

And about the conf/jetty.xml configuration :

-remove this :

<!--
  <Call class="org.mortbay.jetty.webapp.WebAppContext" name="addWebApplications">
    <Arg><Ref id="Contexts"/></Arg>
    <Arg>./apps</Arg>
    <Arg>org/mortbay/jetty/webapp/webdefault.xml</Arg>
    <Arg><Ref id="plusConfig"/></Arg>
    <Arg type="boolean">True</Arg>
    <Arg type="boolean">False</Arg>
  </Call>
-->

+add this instead:

  <New class="org.mortbay.jetty.webapp.WebAppContext">
    <Arg><Ref id="Contexts"/></Arg>
    <Arg>./apps/archiva</Arg>
    <Arg>/</Arg>
    <Set name="configurationClasses"><Ref id="plusConfig"/></Set>
  </New>
SRG
  • 1,569
  • 1
  • 17
  • 19
  • By the way, i'm willing to have only "http://repo.[domain]/ for my main archiva URL in order to be able to have the exact same URL if one day i decide to switch back on Artifactory or something else than Archiva. – SRG Mar 02 '11 at 19:52
  • yeah I had this idea about making it the ROOT application, but I have multiple applications, it seems ridiculous to have to have a separate servlet container instance for every app I want to be a sub-domain, Archiva, Hudson, etc. –  Mar 02 '11 at 20:10
  • On my side, for various reason, that's what i'm doing : i run each application in a separate servlet container, when available, often through Jetty (Hudson, archiva, sonar for example). Why ? Cause i had a lot of memory problem when running all of these in the same tomcat container (permgen space and so one), much simpler now with separated services, each running on a specific port hidden through Apache. – SRG Mar 02 '11 at 20:38
  • [How do you configure stand alone archiva to run as the `ROOT` web app under jetty?](http://stackoverflow.com/questions/5176486/how-to-make-the-stand-alone-archiva-distribution-the-root-application-under-jetty) –  Mar 03 '11 at 04:01
  • Just with the modification of the conf/jetty.xml shown above, that's all : this will map the archiva web application under / instead of /archiva/. – SRG Mar 03 '11 at 04:20
-1

The reason you are getting:

HTTP Status 404 - /archivaarchiva/

is because you didn't end your ProxyPass last path with a / but you did ended the first path with one.

ProxyPass / http://dev.mycompany.com:8080/archiva

both ProxyPass and ProxyPassReverse should end with /

Rewrite to (taking note of the ending /):

ProxyPass / http://dev.mycompany.com:8080/archiva/

see: http:// httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass

If the first argument ends with a trailing /, the second argument should also end with a trailing / and vice versa. Otherwise the resulting requests to the backend may miss some needed slashes and do not deliver the expected results.

  • re-read my question and you will see I tried it both ways and neither way works correctly. read for comprehension, don't just scan the question –  Feb 15 '13 at 06:26