title: CORS problem with Angular and laravel even after setting the CORS header and server response
body: <p>I am new to angular and facing some CORS problem. I tried all the possible solution including setting up CORS header and the server side change. But still not working.</p>
  
  <p>I changed the server end with the header  <strong>'Access-Control-Allow-Origin': '*'</strong> in response. I tried with postman and it's working fine and giving the header response. I also set the header in my Angular app while sending the request. But still giving the error.
  This is the giving:</p>
  
  <p><strong><em>Access to XMLHttpRequest at '<a href="http://skewcommerce.test/api/user/add/" rel="nofollow noreferrer">http://skewcommerce.test/api/user/add/</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: Redirect is not allowed for a preflight request.</em></strong></p>
  
  <p>This is my service to send the request.</p>
  
  <pre><code>import {Injectable} from '@angular/core';
  import {HttpClient} from '@angular/common/http';
  import {HttpHeaders} from '@angular/common/http';
  import {environment} from '../../environments/environment';
  
  @Injectable({
  providedIn: 'root'
  })
  
  export class ApiService {
  baseUrl = environment.APIUrl;
  token: any;
  
  constructor(private http: HttpClient) {
  }
  
  
  postData(url, data) {
  const httpOptions =  new HttpHeaders({
          'Access-Control-Allow-Origin': '*',
          'Content-Type':  'application/json',
          });
  
  
  return this.http.post(this.baseUrl + url + '/', data, {headers : httpOptions});
     }
  }
  </code></pre>
  
  <p>Please help me to know what I did wrong. :(</p>