I have got the tomcat 8 rewrite to work but seems to missing something in rewrite.config that is causing the last condition to not execute. For benefit of others, i have the
I found this question because I had a similar problem. I spent hours looking for a solution that didn't require me to whitelist specific file types. Eventually I decompiled org.apache.catalina.valves.rewrite.RewriteValve and found the answer.
My case is similar, but my Angular app is nested inside an older non-Angular app. That means that the URL to it someting like http://localhost:8080/mywebapp/ng/index.html (the app's base-href is thus "/mywebapp/ng").
I had no luck with rules using REQUEST_URI, REQUEST_FILENAME, or SCRIPT_FILENAME. What worked for me was SERVLET_PATH (no idea why).
I wound up with a solution including these two files:
/META-INF/context.xml:
/WEB-INF/rewrite.config:
RewriteCond %{SERVLET_PATH} !-f
RewriteRule ^/ng/(.*)$ /ng/index.html [L]
The result is that everything which is not a real file gets served by the Angular app.
Note: This worked on Tomcat 8.0 with an AoT compiled Angular2 (v4.0.0) app nested in an existing web-application.