title: Can't get CORS working in Firefox
body: <p>I'm trying to get a simple example working with the MEAN stack and I noticed that my DELETE request does not work in Firefox. I believe this is due to CORS.</p>
  
  <p>When i click a link to submit a DELETE request with angularJS to my ExpressJS backend, I see that a GET request is first called, and then the actual DELETE request is called, but the DELETE request never finishes.</p>
  
  <p><img src="https://i.stack.imgur.com/qTTPG.png" alt="DELETE REQUEST"></p>
  
  <p>This all seems to work in Chrome no problem. No unexpected GET request called, and the DELETE request actually finishes. How can I make this work in Firefox?</p>
  
  <p>Express section for cors:</p>
  
  <pre><code>// CORS Stuff in app.js
  app.all('*', function (req, res, next) {
      res.header("Access-Control-Allow-Origin", "*");
      res.header("Access-Control-Allow-Headers", "X-Requested-With, Content-Type, Authorization, Content-Length");
      res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
  
      if(req.method == 'OPTIONS') {
        res.send(204);
        //next();
      } else {
        next();
      }
  
      //res.send(200);
  });
  
  app.get('/notes', note.get(db));
  app.post('/notes', note.create(db));
  app.put('/notes/:id', note.update(db));
  app.delete('/notes/:id', note.delete(db));
  </code></pre>
  
  <p>Then i have this note.js file </p>
  
  <pre><code>exports.delete = function(db) {
      return function(req, res) {
  
          console.log('were in delete middleware');
  
          //var note_id = req.body.id;
          var note_id = req.params.id;
  
          console.log("note_id = "+note_id);
  
          var collection = db.get('notes');
          collection.remove(
              {_id: note_id}
          ),
  
          function(err, doc) {
              console.log('were in delete middleware function');
              // If it failed, return error
              if (err) {
                  console.log('were in delete error');
                  res.send("There was a problem deleting that note from the database.");
              } else {
                  console.log('were in delete success');
                  res.send(200);
              }
          }
      }
  }
  </code></pre>
  
  <p>My browser url is <code>http://localhost:63342/express_example/public/#/</code></p>
  
  <p><strong>Update</strong></p>
  
  <p>My server responds to the preflight request with this:</p>
  
  <p>Server console:
  OPTIONS /notes/53568807130e0f701f000001 200 0ms - 2b
  GET /notes 304 8ms</p>
  
  <p>Browser console:
  <img src="https://i.stack.imgur.com/BDi3Y.png" alt="enter image description here"></p>