I am currently working with a project using SpringBoot at the backend and HTML5 and Angular 2 at the frontend.
After I deploy the project, everything works fine when I navigate in the browser, until I press reload button. Browser will show error page.
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Mon May 08 10:16:14 CDT 2017
There was an unexpected error (type=Not Found, status=404).
No message available
This is apparently being caused by the use of the HTML 5 history API to store client-side navigation in the browser URL.
So when I start to click on items on the page, I see the URL automatically appends itself.
However, this becomes a problem when refresh is hit, the full appended URL is sent to server which can't understand it because a specific mapping of that appended URL doesn't exist.
Is there a fix to this that updates the server-side configuration so that any unknown URL returns a view of the root index.html view?
For example, when I hit refresh, the URL being queried is simply the root url http://localhost:8080/root
, rather than the appended URL.
This will let the browser properly navigate rather than trying to do it on the server side.