title: Angular 5: Response for preflight has invalid HTTP status code 403
body: <p>When I send a POST request to the server I get an error:</p>
  
  <pre><code>Failed to load http://localhost:8181/test: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access. The response had HTTP status code 403.
  </code></pre>
  
  <p>The backend is written in Java Spring.
  My method for creating a test:</p>
  
  <pre><code>createTest() {
      const body = JSON.stringify({
        'description': 'grtogjoritjhio',
        'passingTime': 30,
        'title': 'hoijyhoit'
      });
  
      const httpOptions = {
        headers: new HttpHeaders({
            'Content-Type': 'application/json',
            'Accept': 'application/json'
          }
        )
      };
  
      return this._http.post(`${this._config.API_URLS.test}`, body, httpOptions)
        .subscribe(res =&gt; {
          console.log(res );
        }, error =&gt; {
          console.log(error);
      });
    }
  </code></pre>
  
  <p>Get Method works, but Post doesn't. They both work in Swagger and Postman. I changed POST method many times. The headers in my code do not work, but I solved the problem with them expanding to Google Chrome. There was only an error:</p>
  
  <pre><code>Response for preflight has invalid HTTP status code 403.
  </code></pre>
  
  <p>It seems to me that this is not Angular problem. Please tell me how I or my friend (who wrote the backend) can solve this problem.</p>