How to send 404 Headers in Meteor + React

I’m not sure if this should be done in Meteor or in React but I cannot figure out how to send 404 headers for not found errors.

I’m using React Router 4 and I have a catch all Router for not found but it does send a 200 status. Need to send 404 status.

I’m using Meteor 1.5.1 and React with React Router 4

@rjdavid
I really need that too.
I mean, in addition to rendering 404 component, I also want 404 error to be wasted.
Of course, I also use the rendering server and fast rendering.
Have you come up with a solution?

onPageLoad(sink => {
  sink.setStatusCode(404);
});
2 Likes

So how do we check for the correct routes?

It depends on your implementation. Your react component must be able to pass data to your ssr handler. One possible solution is the static context of react router (documentation available in react router site)