I deployed my WAR-file containing a running Java Spring/AngularJS application to a Tomcat8 which is running behind an Apache2 with the following config:
<VirtualHost *:80>
ServerName example.de
ServerAlias www.example.de
ProxyPass / http://localhost:8080/example/
ProxyPassReverse / http://localhost:8080/example/
<Location "/">
Order allow,deny
Allow from all
</Location>
</VirtualHost>
So far so good, this is running. Now I wanted to switch to HTML5-mode, so I solved all the prerequisites on the client-side.
For the backend I started with exposing the Tomcat webapp to http://www.example.de:8080/example/ to add rewrite rules for Tomcat8. First I tried out with Tuckeys UrlRewriteFilter and then noticed, that there is a RewriteValve for Tomcat8, now.
So I created a WEB-INF/rewrite.config in the application now:
RewriteCond %{REQUEST_URI} ^/(css|img|js|templ|api|config|userdata|fonts).*$
RewriteRule ^.*$ - [L]
RewriteRule ^.*$ /index.html [L,QSA]
My /opt/tomcat/conf/context.xml looks like that:
<Context usehttponly="true">
<Valve className="org.apache.catalina.valves.rewrite.RewriteValve" />
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
</Context>
When hitting localhost:8080/example/ now, EVERY request is rewritten to index.html, so probably all assets contain the contents of index.html. At least rewriting is enabled now, but it's not doing what I want.
Can someone find something that I'm doing wrong here? Is there a possibility to debug this? I'm feeling like stepping in the dark right now.
If it helps, this is my WEB-INF/web.xml, located in the application: https://gist.github.com/JonasPriest/998099c509b2173ba3b1
Is there maybe a solution to delegate rewriting to the Apache2 instead of Tomcat?