title: Express.js, Unexpected token <
body: <p>I have simple express server which looks like that:</p>
  
  <p><strong>Epxress application:</strong></p>
  
  <pre><code>var express = require('express');
  var compression = require('compression');
  var path = require('path');
  var cors = require('cors');
  var router = express.Router();
  
  var app = express();
  
  app.use('/bundle', express.static(path.join(__dirname, '/bundle')));
  
  app.enable('trust proxy');
  
  app.use(compression());
  
  app.get('*', function(req, res) {
      res.header('Cache-Control', "max-age=60, must-revalidate, private");
      res.sendFile( path.join(__dirname, 'index.html') );
  });
  
  
  var server = app.listen(process.env.PORT || 5000, function () {
      var host = server.address().address;
      var port = server.address().port;
      console.log(`Example app listening at http://%s:%s`, host, port);
  });
  </code></pre>
  
  <p>And simple <strong>html file:</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;React Router test&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div id="root"&gt;&lt;/div&gt;
      &lt;script src="bundle.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Inside of bundle.js i have ReactJS application with client-side routing:</p>
  
  <pre><code>render((
      &lt;Router history={browserHistory}&gt;
          &lt;Route path="/" component={App}&gt;
              &lt;Route path="about" component={About} /&gt;
              &lt;Route path="about2" component={About2} /&gt;
              &lt;Route path="about3" component={About3} /&gt;
              &lt;Route path="*" component={NoMatch} /&gt;
          &lt;/Route&gt;
          &lt;Route path="*" component={NoMatch} /&gt;
      &lt;/Router&gt;
  ), document.getElementById('root'));
  </code></pre>
  
  <p>Whenever i try to navigate to <strong>domain:port/</strong> (this route is supported by router) everething is OK.
  But when i try to navigate to more complex URL, like <strong>domain:port///..</strong> etc i got an error in browser:</p>
  
  <pre><code>bundle.js:1 Uncaught SyntaxError: Unexpected token &lt;
  </code></pre>
  
  <p>looke like instead of send bundle.js from static server response with index.html and inside bundle.js there is html markup. </p>
  
  <p>How can i fix this?</p>
  
  <p>Thanks!</p>