0

I have a Spring Boot + React app deployed to Elastic Beanstalk and the index pages comes up. When I go to any other page, it gives 404. Of course locally it is just fine.

The "api" mappings work correctly. I cannot get to the login page, or anything else other than index. Anything would help here.

update I see that you have to do a redirect via nginx or apache. It is hard to figure this out via Elastic Beanstalk. If anyone has a fix or way to do this it would be appreciated.

MattGMac
  • 1
  • 2
  • Are you serving your React app within your Spring boot app (by copying the React-files to the public/static folder of your Spring boot app)? If so, did you redirect all 404s back to index.html (which you should do for single page apps)? – g00glen00b Mar 26 '22 at 17:36
  • Yes, and I have found that out now. Although configuring Beanstalk instance & nginx isn't very straightforward. – MattGMac Mar 26 '22 at 19:20
  • You can do it in Spring boot as well: https://stackoverflow.com/q/43913753/1915448 I know the linked question talks about Angular, but it's the same for all frameworks that use the history API for routing (Angular, React, ...). – g00glen00b Mar 26 '22 at 20:02

0 Answers0