Using multiple ServerPath directives inside a named VirtualHost

I am trying to create a virtual host, dev.company.com, which is routed to different applications depending on what happens after the domain. In particular, I want:

I am using the following configuration:

<VirtualHost *:80>
  ServerName dev.company.com

  ServerPath /jenkins
  ProxyPass /jenkins http://easyrider:8080/jenkins
  ProxyPassReverse /jenkins http://easyrider:8080/jenkins

  ServerPath /clover
  Redirect /clover http://dev.company.com/jenkins/job/proj-master-clover/clover/

  ServerPath /apps
  DocumentRoot "/usr/local/sites/developers"
  <Directory "/usr/local/sites/developers">
        DirectoryIndex index.html
        Options Indexes MultiViews
  </Directory>

  ServerPath /
  ProxyPass / http://tomcat_server:8080/
  ProxyPassReverse / http://tomcat_server:8080/
</VirtualHost>

http://dev.company.com/jenkins works fine, but / apps and / clover always redirect to the Tomcat server. The right way to do this?

+5
1

, ServerPath . , , , VirtualHost, catch-all:

ProxyPass / <url>

ProxyPass : ProxyPass /path !

, VirtualHost :

<VirtualHost>
    ServerName dev.company.com

    ProxyPass /jenkins http://easyrider:8080/jenkins
    ProxyPassReverse /jenkins http://easyrider:8080/jenkins

    # Tells ProxyPass to ignore these paths as they'll be handled by Alias and Redirect
    ProxyPass /clover !
    ProxyPass /apps !        

    Redirect /clover http://dev.company.com/jenkins/job/proj-master-clover/clover/

    Alias /apps "/usr/local/sites/developers"
    <Directory "/usr/local/sites/developers">
        DirectoryIndex index.html
        Options Indexes MultiViews
    </Directory>


    ProxyPass / http://tomcat_server:8080/
    ProxyPassReverse / http://tomcat_server:8080/
</VirtualHost>

URL:

http://dev.company.com/jenkins* - will proxy to jenkins http://dev.company.com/jenkins
http://dev.company.com/apps - will proxy to http://dev.company.com/apps/
http://dev.company.com/clover - will redirect to http://dev.company.com/jenkins/job/proj-master-clover/clover/
and everything else will go to tomcat at tomcat_server:8080
+8

All Articles