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

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

For requests are forwarded to Tomcat (it works)

For 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>
   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 ->It works
   <LocationMatch "">

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

   #Forward to App1 -> It works
   <LocationMatch "^/app1(.*)">

   #Forward to App1 and call the filter -> It works
   <LocationMatch "^/App1/specialpage(.*)">

      SetOutputFilter   outFilter

  • Using "curl -I" command, I noted that /app3 are forwarded wrongly to so LocationMatch take priority to Alias directive. How I can invert the order? – fciri Aug 9 '18 at 9:43

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"
  • Thanks @HBruijn♦ but I got and error starting Apache: "Alias not allowed here" – fciri Aug 9 '18 at 10:23
  • Hmmm, that syntax is dependant on he Apache http version "This syntax is available in Apache 2.4.19 and later." – HBruijn Aug 9 '18 at 10:27
  • I will try to update Apache – fciri Aug 9 '18 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.