Report this

What is the reason for this report?

React routing not working on static site

Posted on October 21, 2024

I successfully deployed my ReactApp onto an App Platform as a static site in the base directory. The home page loads, but every other link goes to a 404. So, it appears that the routing is not working.

I’ve looked up the following solutions: -Set “index.html” as a custom catch-all page. This just makes every link go back to the home page, and some other very odd behaviour when my Axios REST calls fail, which seem to return a copy of index.html -Add “routes” to the app spec My app spec yaml file does not have any routes. Not sure where to put it.

The routing has never been a problem in development on my local machine. Does anyone know how to solve this?

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.