Hi everyone, my question is not specific to the Tomcat version specified in the subject line. I am trying to implement a URL rewrite or redirection using Tomcat. What I want to do is the following:
In a given instance of Tomcat, I have each application context setup using the xml files in $CATALINA_BASE/conf/[enginename]/[hostname]/, so far so good. Hence for app1 I then have the URL: https://myserver:myport/app1, etc. What I need to do, is to have a dummy application which purpose is just to redirect/rewrite the URL from one application to another. So, I need in fact an empty application capturing each request and send back to the browser a rewritten URL to the another application. For example, suppose I want to redirect app1 to app2, I need to rewrite all possible URL with query options and so one replacing only app1 by app2 in the URL. https://myserver:myport/app1/something_more_specific?opt1 should be rewritten as https://myserver:myport/app2/something_more_specific?opt1 To do this, I read about the rewrite valve here: http://tomcat.apache.org/tomcat-8.5-doc/rewrite.html So, I created an empty directory $CATALINA_BASE/webapps/app1 with the following file: $CATALINA_BASE/webapps/app1/WEB-INF/rewrite.config And my $CATALINA_BASE/conf/[enginename]/[hostname]/app1.xml has the following entry within its context: <Valve className="org.apache.catalina.valves.rewrite.RewriteValve"/> My rewrite.config file is as follow: RewriteCond %{REQUEST_URI} ^/app1/?.* RewriteRule ^/app1(/?.*)$ /app2$1 [L] Without anything else, I am getting a HTTP 404 code. With an empty index.html I am getting a blank page. Within a working application I am getting the application's welcome page. But never the URL is rewritten. The rewrite.config file is actually read, I checked by introducing some typo and I am getting an error message at startup. Is there a way to debug this problem? How can I see what is going on with the execution of the rewriting class? Regards, ----------------- Daniel Savard