title: Invalid CORS request
body: <p>I'm making a page in <code>angularJs</code>, when I send request to my API, it is generate error: </p>
  
  <p><a href="https://i.stack.imgur.com/2rZwg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2rZwg.png" alt="enter image description here"></a></p>
  
  <p>My code is:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html ng-app="AppIndex"&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;Hola mundo&lt;/title&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.9/angular.min.js"&gt;&lt;/script&gt;
      &lt;script src="ControllerIndex.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body ng-controller="ControllerIn"&gt;
      {{"Hola Mundo" + nombre}}
      &lt;button ng-click="metodos()"&gt;Enviar&lt;/button&gt;
      &lt;ul&gt;
          &lt;li ng-repeat="response in posts"&gt;
              &lt;h2&gt;holaaaaa&lt;/h2&gt;
              &lt;p&gt;{{response.title}}&lt;/p&gt;
              &lt;p&gt;{{response.body}}&lt;/p&gt;
          &lt;/li&gt;
      &lt;/ul&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  
  
  <p>and javaScript</p>
  
  <pre class="lang-js prettyprint-override"><code>angular.module("AppIndex",[])
  .controller("ControllerIn", function($scope, $http){
      $scope.nombre = "Juan";
      $scope.newPost = {};
      $scope.responses = [];
      $scope.metodos = function(){
          $http({
                  method: 'POST',
                  url: 'http://localhost:900/Servicios/forgotPassword',
                  Headers: {"Access-Control-Allow-Origin": "http://127.0.0.1", "Access-Control-Allow-Methods": "POST", "Content-Type" : "application/json"},
                  data: {"user" : "admin1"}
               }).then(function (response){
                  console.log(response);
                  $scope.posts = response;
               },function (error){
                  console.log(error);
               });
      }
  })
  </code></pre>
  
  
  
  <p>The error message is:</p>
  
  <blockquote>
    <p>POST <a href="http://localhost:900/Servicios/forgotPassword" rel="nofollow noreferrer">http://localhost:900/Servicios/forgotPassword</a> 403
    {data: "Invalid CORS request", status: 403, config: {…}, statusText: "", headers: ƒ, …</p>
  </blockquote>
  
  <p>I'm using <code>AngularJS 1.7.9</code></p>