Issue: I have an Angular frontend combined with a Spring Boot backend, running on a Tomcat 10 server. The routing within the application works flawlessly, but I encounter a persistent issue whenever I attempt to reload the page, leading to a 404 resource not found error.

Here's the structure of my setup:

Angular application located in webapps/ROOT Spring Boot backend situated under webapps/spec My application.yaml configuration:

server:
port: 8081
servlet:
context-path: /spec

Question: How can I resolve the issue of encountering a 404 resource not found error upon reloading the page in my Angular-Spring Boot application setup on a Tomcat 10 server? Additionally, how can I ensure that both frontend and backend functionalities are maintained intact even after implementing a solution for page reloads?

Things I've Tried:

Added <Valve className="org.apache.catalina.valves.rewrite.Rewr iteValve" />
in server.xml and configured rewrite.config with the following rules:

RewriteCond %{REQUEST_URI} !-f
RewriteRule ^/(.*)$ /index.html
This solution somewhat works as it allows page reloads without encountering a 404 error. However, it fails to load the backend, thus hindering functionalities like user login.