title: Spring\Tomcat redirect to angular page on 404 error
body: <p>I have an application written in Spring (rest api) and deployed on Tomcat. On the same context exists angular 4 application using this api. I would like to redirect all 404 errors to error page in angular app. I managed to redirect all url in pattern <code>\app\#\some\url</code> by using appropriate angular route. But this those not help with url like <code>\app\some\url</code> which are not handled by angular. In case of such url Tomcat returns it's default page. I managed to redirect all 404 error to angular main page by using following code in web.xml file.</p>
  
  <pre><code>&lt;error-page&gt;
      &lt;error-code&gt;404&lt;/error-code&gt;
      &lt;location&gt;/&lt;/location&gt;
  &lt;/error-page&gt;
  </code></pre>
  
  <p>But when I changed <code>/</code> for <code>/#/404</code> (error page form angular app) and tried to access non-existent url I just get blank page instead of redirection. Is there a way to configure my app or server to redirect to this error page? Or do I have to copy this page and put it in WEB-INF so I can use it as static page? I would like to avoid second option as in this case I have to duplicate this page and in case of changes remember about both of them.</p>