title: Error with CORS - Angularjs $http.post
body: <p>I am trying to do a $http.post, but this response give me this error. </p>
  
  <blockquote>
    <p>XMLHttpRequest cannot load <a href="http://XXXXXXXXX:2222/server/api/v1/controllers" rel="nofollow noreferrer">http://XXXXXXXXX:2222/server/api/v1/controllers</a>. Response for preflight has invalid HTTP status code 403</p>
  </blockquote>
  
  <p>All of I read on internet sais that Its a fault by the CORS, I try to solve this with no success.</p>
  
  <p>Here is my $http.post method.</p>
  
  <pre><code>        // Set the Content-Type 
          $http.defaults.headers.post["Content-Type"] = "application/json";
  
          // Delete the Requested With Header
          delete $http.defaults.headers.common['X-Requested-With'];
  
  
  
          var config = {
              method: 'POST',
              headers: {'Content-Type': 'application/json; charset=utf-8'}
           }
  
          $http.post("http://XXXXXXXXX:2222/server/api/v1/controllers", objToSave , config)
            .then(function successCallback(response) {
              // this callback will be called asynchronously
              // when the response is available
              console.log(response)
            }, function errorCallback(error) {
              // called asynchronously if an error occurs
              // or server returns response with an error status.
              console.log(error)
            });
  </code></pre>
  
  <p>I am using Angular v1.5.5.</p>
  
  <p>I hope You can help me,</p>
  
  <p>Regards!</p>