When the front-end uses React-Router for routing, the packaged static files can be directly accessed by throwing them into Tomcat, but when we refresh the browser or open a non-existent page, we will find the front-end interface ghosts . . . .
I took a look at the routing method of react-router today. After thinking about it, when I refreshed it, hey, it was because the page specified on the url could not be found. When the 404 was turned back to the index, it was over. The history of react-router would help. I'm positioned back
Then, find the file in the conf directory web.xml
, and then add a sentence to let him locate it and it's done.
<error-page>
<error-code>404</error-code>
<location>/index.html</location>
</error-page>