We have a handler for all non-specified routes:
<ReactRouter.Route path="*" component={Handle404} />
But this returns a 200. How can we return a 404 status code?
We have a handler for all non-specified routes:
<ReactRouter.Route path="*" component={Handle404} />
But this returns a 200. How can we return a 404 status code?
We cannot send status code from client-side. For SPAs, when browser requests for page, it just downloads the javascript files and pages are rendered on browser side. Routing is handled purely on client-side. Even when we request server for 404 page, the request to download the page content is successful so it will be status 200 only. Eventhough actual page content is "Page not found".
If you need to send specific case you might want to hadle it at server-side. However, you can always create custom pageNotFound page.