I have an Angular application running live on Tomcat, but since I have implemented routing, if I visit a url manually I get a 404 not found. Also when an error occurs, it's a basic server page, not my error url page.
How do I configure Tomcat to always return index.html on routing and on errors? I know the set up, as I have done it with a different server, I'm just new to Tomcat and couldn't find anything online.
From my understanding, it's a pretty straightforward few lines of code in other back-end languages, I just can't find any info on Tomcat.
Basically you have to change web.xml file inside conf folder of the Tomcat directory: $CATALINA_HOME/conf/web.xml.
<error-page>
<error-code>404</error-code>
<location>/error/index.html</location>
</error-page>
And add a webapp that has the page and will answer to the URL under given location.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With