Apache Alias and LocationMatch togheter

apache-2.4

I am trying to configure Apache to serve 3 application with this url schema.

For http://10.1.0.101 and http://10.1.0.101/App1 requests are forwarded to another server. For a special url for App1 an output filter is called (it works).

For http://10.1.0.101/App2 requests are forwarded to Tomcat (it works)

For http://10.1.0.101/App3 requests should be forwarded to /var/www/html but it doesn't works and I got a 404. How can I use the directvive Alias to works as expected?

Thanks to all

<VirtualHost *:80>
   ServerName 10.1.0.101
   ProxyRequests Off
   ProxyPreserveHost On

   #Define a filter
ExtFilterDefine outFilter mode=output \
cmd="/var/www/cgi-bin/out-filter.pl /tmp/out-filter.out"

   DocumentRoot /var/wwww/html

   #forward app3 to /var/www/html ->*** It doensn't work *** 
   Alias /app3 /var/www/html

   #Make App1 default app when user use http://10.1.0.101 ->It works
   <LocationMatch "">
      ProxyPassMatch  http://10.1.0.100/App1
      ProxyPassReverse  http://10.1.0.100/App1
   </LocationMatch>

   #Forward to App2. ->It works
   <LocationMatch "^/app2(.*)">
      ProxyPassMatch   http://localhost:8080/app2$1
      ProxyPassReverse http://localhost:8080/app2/$1
   </LocationMatch>

   #Forward to App1 -> It works
   <LocationMatch "^/app1(.*)">
      ProxyPassMatch   http://10.1.0.100/App1$1
      ProxyPassReverse http://10.1.0.100/App1$1
   </LocationMatch>

   #Forward to App1 and call the filter -> It works
   <LocationMatch "^/App1/specialpage(.*)">
      ProxyPassMatch   http://10.1.0.100/App1/specialpage$1
      ProxyPassReverse http://10.1.0.100/App1/specialpage$1

      SetOutputFilter   outFilter
   </LocationMatch>

</VirtualHost>

Best Answer

Put your Alias directive in a Location(Match) as well to ensure that URL path is merged consistently with your other sections.

   <LocationMatch "^/app3(.*)">
        Alias "/var/www/html"
   </LocationMatch>
Related Topic