title: Cross Origin Resource Sharing (CORS) in Angular or Angular 6. Problem while you make cross domain calls on localhost with different ports
body: <p>I have come across a situation where I make a call from my angular 6 application to my spring boot application. When I call an HTTP post method in angular to the application running on a different port it throws an exception. </p>
  
  <p>Access to XMLHttpRequest at '<a href="http://localhost:8080/api" rel="nofollow noreferrer">http://localhost:8080/api</a>' from origin '<a href="http://localhost:4200" rel="nofollow noreferrer">http://localhost:4200</a>' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.</p>
  
  <p>My Angular application Running on '<a href="http://localhost:4200" rel="nofollow noreferrer">http://localhost:4200</a>' port number:4200
  My Spring Boot application running on '<a href="http://localhost:8080/api" rel="nofollow noreferrer">http://localhost:8080/api</a>': port number:8080.</p>
  
  <p>There is no direct answer to solve this problem. There are few hacks to disable the security in chrome and using NGINX you can resolve this issue. </p>