title: Response for preflight has invalid HTTP status code 404 angular js
body: <p>I am trying to prepare a <code>Delete</code> request in <code>AngularJS</code> to a <code>nodeJS</code> local server:</p>
  
  <pre><code>this.deleteMusician = function(id) {
          $http({
              url: 'http://localhost:3000/musicians/' + id,
              method: "DELETE",
              data: {}
              //processData: false,
              //headers: {'Content-Type': 'application/x-www-form-urlencoded'}
          }).success(function (data, status, headers, config) {
              console.log(data);
          }).error(function (data, status, headers, config) {
              console.log(data);
          });
      };
  </code></pre>
  
  <p>And my <code>nodeJS</code> route looks like this:</p>
  
  <pre><code>app.delete('/musicians/:id', musicians.delete);
  </code></pre>
  
  <p>The same request via PostMan works, but on Google Chrome i get:</p>
  
  <pre><code>OPTIONS http://localhost:3000/musicians/5628eacaa972a6c5154e4162 404 (Not Found)
  XMLHttpRequest cannot load http://localhost:3000/musicians/5628eacaa972a6c5154e4162. Response for preflight has invalid HTTP status code 404
  </code></pre>
  
  <p>CORS is enabled:</p>
  
  <pre><code>var allowCrossDomain = function(req, res, next) {
    // Website you wish to allow to connect
    res.setHeader('Access-Control-Allow-Origin', 'http://localhost');
  
    // Request methods you wish to allow
   res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
  
    // Request headers you wish to allow
    res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
  
    // Set to true if you need the website to include cookies in the requests sent
    // to the API (e.g. in case you use sessions)
    res.setHeader('Access-Control-Allow-Credentials', true);
  
    // Pass to next layer of middleware
    next();
  };
  </code></pre>
  
  <p>app.use(allowCrossDomain);</p>