When running my spring app from my IDE and running the React app from within VSCode, everything worked perfectly. I used the build
script to build my React project, and then put the output into my /static
folder of Spring. Then I used mvn clean install
to build the .jar file. After running the entire app from the .jar file, I can access my homepage with localhost:5000. I can also use my navbar links to access different parts of the website, like the Home page and the About page... But if I try to manually enter the url localhost:5000/about
I get a 404 Not found error.. What am I doing wrong?
Asked
Active
Viewed 239 times
-1

randomboiguyhere
- 525
- 5
- 17
1 Answers
0
My guess is that your Spring (webmvc?) application is not configured to listen to different URLs other than /
. And while it may seem as if the navbar successfully redirects to http://localhost:5000/about
, in reality the single page application uses JavaScript client-side routing to change the URL in the browser, unload the currently rendered page, and load another page.
If you are indeed using Spring MVC, you could (among other options) modify your Spring static resource configuration, modify your @RequestMapping
to listen to multiple endpoints, or use a ViewControllerRegistry
.

Michiel
- 2,914
- 1
- 18
- 27