How to let react router respond with 404 status code?
<p>I'm using react router as root and all requests under "/" are directed to react router. And when react router found that the url is not matched with any of the defined components, it renders with NoMatch component. And here goes the problem, NoMatch is rendered and that's what I want, but the status code is still 200 instead of 404. And when my css or js files are placed with a wrong url react router does the same thing, it responds with 200! And then the page tells me that there's some problem with my resources content type!</p>

<p>So, how can I use react router to handle everything in the "/" and still get it to treat 404 errors right(to respond with 404 status code)?</p>

<p>code in react router</p>

<pre><code>render((
  &lt;Router history={browserHistory}&gt;
    &lt;Route path="/" component={App}&gt;
      &lt;IndexRoute component={Index}/&gt;
      &lt;Route path="archived" component={App}&gt;
        &lt;IndexRoute component={ArchivedPage}/&gt;
        &lt;Route path="project/:projectId" component={ArchivedDetailPage}/&gt;
      &lt;/Route&gt;
      &lt;Route path="*" component={NoMatch}/&gt;
    &lt;/Route&gt;
  &lt;/Router&gt;
), document.getElementById('app'));
</code></pre>

<p>the servre side</p>

<pre><code>  router.use('/', function(req, res, next) {
    res.render('index-react', {
      title: 'some title'
    });
  });
</code></pre>