MrNVK
MrNVK

Reputation: 372

How to return index page for all requests?

In my project, I decided to use Spring boot on the server side and React on the client side. Page navigation should be performed on the client using React-router. One of the conditions of the router is that each request to server must return an index.html page. I have an index.html in /resources/static/ folder and Spring boot use it for / and /index requests. Also this folder contains resources such as JS and CSS folders and files. But I want to use index.html for all requests (e.g. http://my.domain/unknown/page/) except http://my.domain/static/** because this path for client-side application.

How can I do this?

Upvotes: 1

Views: 640

Answers (1)

xenteros
xenteros

Reputation: 15842

The easiest solution will be to redirect all request to a certain page e.g. / and return index.html on / page. This can be done on your server engine configuration.

Upvotes: 1

Related Questions