title: Express JS router sometimes returns 404 and sometimes 200
body: <p>I use angular 2 and express js. So for all requests which is not css, images, js, video I send index.html file. My router code:</p>
  <pre><code>router.get(/\/(?!((.*\.html$)|(.*\.css$)|(.*\.mp4)|(.*\.woff)|(.*\.js$)|(.*\.map$)|(.*\.jpg$)|(.*\.jpeg$)|(.*\.png$)|(.*\.gif$))).+$/gmi,
    ensureConnect.ensureLoggedIn({ redirectTo: '/' }),
    function(req, res) {
      res
        .set('Content-Type', 'text/html')
        .sendFile(../dist/index.html);
    });
  </code></pre>
  <p>For root router <em>'/'</em> it works perfect, but if I try open another page (e.g. <em>'/product/am-0596157134'</em>) it sometimes open page, but sometimes returns 404 (<strong>Cannot GET /product/am-0596157134</strong>)</p>
  <p>So I tried to reload page twice and for the 1st reload it returns 404 and for the 2nd one - it returns 200. Here is log:</p>
  <blockquote>
  <p>::ffff:127.0.0.1 - - [10/Nov/2016:11:46:24 +0000] &quot;GET /product/am-0596157134 HTTP/1.1&quot; 404 34 &quot;-&quot; &quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36&quot;</p>
  <p>::ffff:127.0.0.1 - - [10/Nov/2016:11:46:25 +0000] &quot;GET /product/am-0596157134 HTTP/1.1&quot; 200 2299 &quot;-&quot; &quot;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36&quot;</p>
  </blockquote>
  <p>Any ideas why it happens, and how to fix it?</p>