5

My single-spa contains 4 react applications. Each has its own react-router-dom. If I hit browser refresh from one of the 4 applications it says page not found. Application is deployed in the apache server in Linux OS.

I don't know whether I'm missing any configuration in the base application. It works fine in the development server which is webpack and node.

2

1 Answer 1

4

Yes, because your deployed application is not aware of the routes. In single page applications, only your / route exists. All routes in SPAs are client side routes and don't make seperate GET request to the server.

I faced the same issue when deploying my application to netlify. It showed default netlify 404 page. Then I added _redirects file to public directory with following contents:

/* /index.html 200

This redirected all 404 routes to default index.html and thus used the client side routing. You need to find something similar for your deployed version.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, @Shubham Shinde. If anybody wants help with the ".htaccess" file use this link docs.bolt.cm/4.0/howto/making-sure-htaccess-works

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.