title: Angular $http.delete CORS error (preflight request)
body: <p>I have an Angular app (v1.13.15) and Express.js(v4.12.4) as backend.</p>
  
  <p>I have a DELETE method in my backend, and I have enabled CORS support for it.</p>
  
  <p>But, when I use Angular $http.delete, I run into this error</p>
  
  <p><strong>No 'Access-Control-Allow-Origin' header is present on the requested resource.</strong></p>
  
  <p>I have tried using Jquery, $.ajax() call for it, and I get the same problem!</p>
  
  <p>I also tried using POSTMAN to do a DELETE request and there is no problem.</p>
  
  <p>But, I have no problem accessing using my Angular for my GET and POST method..</p>
  
  <p>May I know what is this problem?</p>
  
  <p>My backend URL 
  <a href="http://localhost:3000" rel="nofollow noreferrer">http://localhost:3000</a></p>
  
  <p>I serving my AngularJS using gulp-webserver
  <a href="http://localhost:8000" rel="nofollow noreferrer">http://localhost:8000</a></p>
  
  <p>My server code</p>
  
  <pre><code>exports.deleteGPSData = (req, res, next) =&gt; {
  res.header('Access-Control-Allow-Origin', '*');
  res.header('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
  res.header('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
  
  let id = req.params.id;
  
  res.send('here');
  }
  </code></pre>
  
  <p>and my Angular code</p>
  
  <pre><code>$http.delete(API_URL + '/gps/' + id)
                  .success(function(res) {
                      if (res.result !== 1) {
                          return defer.reject(new Error(id + ' failed to delete'));
                      }
  
                      defer.resolve(res.id);
                  })
                  .error(function(status) {
                      defer.reject(status);
                  });
  </code></pre>
  
  <p>I have no problem with GET and POST method! only when I use DELETE method, I ran into CORS errors!</p>
  
  <p>I have attached a screenshot below for the request header using Google Chrome</p>
  
  <p><img src="https://i.stack.imgur.com/mbm0p.png" alt="Angular CORs problme"></p>
  
  <p>Below is the screenshot from Postman,</p>
  
  <p><img src="https://i.stack.imgur.com/T5LYp.jpg" alt="POSTMAN delete"></p>