Most common use case is to use Apache as reverse proxy, but in this short article we will discuss how to do the opposite! You might need this if you have had Tomcat hosting your critical applications and you dont want to lose any performance or speed by having every request forwarded from Apache to Tomcat.
This is specific to Tomcat 9.0 and Apache 2.4 but may work versions closer to these.
We will be using something called “rewrite valve” that Tomcat has. You can read more about it here: https://tomcat.apache.org/tomcat-9.0-doc/rewrite.html. Go to <Tomcat Home>/conf/server.xml and add an entry at the bottom but before the closing tag </Host>
<Valve className="org.apache.catalina.valves.rewrite.RewriteValve" />
Next go to <Tomcat home>/conf/Catalina/localhost and create a file with name rewrite.config and copy the below rewrite rule:
RewriteRule /blog http://localhost:8080 [L,R=301]
What this does is forward any URL that matches /blog to the tomcat that is running at localhost:8080. Obviously you will need to modify this to your needs and per your configuration.