title: Cross-Origin Request Blocked, with post request Angular and Spring
body: <p>I have created an Angular service, it is authorization service with my own back end.</p>
  
  <p>I have to send a form data to my backend, reqData={"username":"string", "password":"string"}</p>
  
  <p>and some standard headers.</p>
  
  <p>My sign-in component.ts</p>
  
  <pre><code>onSignIn(form: NgForm) {
    const email = form.value.email;
    const password = form.value.password;
  
    const reqData = {
      'app_uname': email,
      'app_pass': password
    };
  
    const response = this.authService.signInUser(reqData);
  }
  </code></pre>
  
  <p>My authService:</p>
  
  <pre><code>signInUser(reqData){
      const headerInfo = new Headers({
                                              'Content-Type': 'text/plain',
                                              'X-TIME-ZONE': '+5.30',
                                              'X-DEVICE-ID': '911422351920594',
                                              'X-APP-VERSION': '45',
                                              'X-APP-CHANNEL-NAME': 'ANDROID',
                                              'X-DEVICE-OS-VERSION': '45',
                                              'X-DEVICE-MODEL': 'ANDROID'
                                              });
      const request = this.http.post('http://server-ip/login', reqData, {headers: headerInfo});
  
      request.subscribe(
            (response) =&gt; console.log('Success' + response),
            (error) =&gt; console.log('Error' + error)
      );
  }
  </code></pre>
  
  <p>I am at the moment just checking if I'm able to send the data.</p>
  
  <p>I get this error in the log:</p>
  
  <pre><code>Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://server-ip/login. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).[Learn More]
  
  
  Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://server-ip/login. (Reason: CORS request did not succeed)
  </code></pre>
  
  <p>Presently my Angular app is hosted locally and my backend in a another computer and communication is via lan.</p>
  
  <p>If I send the same request in post-man, it is works fine, I am sending the request data as form data: where key should be reqData and value should be JSON.</p>
  
  <p><a href="https://i.stack.imgur.com/onK4T.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/onK4T.png" alt="PostMan Image"></a></p>
  
  <p>Am I doing something wrong in typescript?</p>