I am working with Angular2 and an Apache Tomcat 8. When opening my website with the root url it works and clicking buttons redirects to the specific urls. But when manually opening a specific url or reloading the webpage it gives me a 404.
I found this solution: Angular 2.0 router not working on reloading the browser but there is no explanation how to solve it with a tomcat.
I tried this in the web.xml of tomcat8:
<servlet>
<servlet-name>html-mapping</servlet-name>
<jsp-file>/index.html</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>html-mapping</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
Then I have no 404 anymore (it loads all files like the main.bundle.js) but only the Angular2 "Loading..." text is shown and it does not continue to open the WebApp.