Apache mod_rewrite in proxy mode, .htaccess and ProxyPassReverse

apache-2.2mod-proxymod-rewriteproxypasstomcat6

In a .htaccess file, I have something like this to proxy Apache to Tomcat:

   RewriteRule (.*) http://localhost:8080/tomcat-app/$1 [P]

All the redirects as well as internal links in HTML files are going to the Tomcat app directly, rather than to Apache.

So I would use ProxyPassReverse and the like to translate correctly, but apparently I'm not allowed to use that directive in a .htaccess file. I don't really want to put them into the master Apache configuration because that means rebooting Apache every time there is a change. Which is why I like the RewriteRole [P]: unlike ProxyPass, it can be put into .htaccess.

What can I do to simulate ProxyPassReverse in a .htaccess file? Or more specifically, without requiring reboots on any change?

Best Answer

Use your main config file - you can do a graceful config reload by sending a USR1 signal to the process - your apache init script should have a reload command to do this.

/etc/init.d/apache2 reload