title: CORS : Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request
body: <p>I am trying to integrate the angualar js app with the backend spring boot , in which i am facing the redirection is not allowed for a preflight request</p>
  
  <p>This is deployed on openshift , i have configured to enabled cors by adding few annotation in the controller method , which helped me to solve the : 
   Request doesnot have "Access-Control-Allow-Origin" header in the incoming request : CORS policy issue.</p>
  
  <pre><code>    @CrossOrigin(allowedHeaders = "*", origins = "*", exposedHeaders = 
          "Access-Control-Allow-Origin", methods = {
            RequestMethod.POST, RequestMethod.GET, RequestMethod.PUT, 
      RequestMethod.DELETE, RequestMethod.HEAD,
            RequestMethod.OPTIONS, RequestMethod.PATCH, RequestMethod.TRACE })
      @RestController
      public class Controller {
  
     @Autowired
     Service botService;
  
     @Autowired
     Environment env;
  
     @CrossOrigin()
     @RequestMapping(value = "/jwtToken", method = {
                   RequestMethod.POST }, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
     @ResponseStatus(HttpStatus.OK)
     public ResponseEntity&lt;UnifiedService&gt; botConntor(                     
                   @RequestBody UnifiedInput input, HttpServletRequest request) {
            UnifiedBPMService output = botService.processBotRequest(input, request);
            return new ResponseEntity&lt;UnifiedService&gt;(output, HttpStatus.OK);
     }
  </code></pre>
  
  <p>The error which i get in the actual angular app is:</p>
  
  <blockquote>
    <p>Access to XMLHttpRequest at 'http:///chatbot/api/jwtToken' from 
            origin 'http://' has been blocked by CORS policy: Response 
            to preflight request doesn't pass access control check: Redirect is not 
            allowed for a preflight request.</p>
  </blockquote>
  
  <p>The options call has returned the below respose :</p>
  
  <pre><code>    Request URL: http://&lt;domain&gt;/chatbot/api/jwtToken
      Request Method: OPTIONS
      Status Code: 302 Found
      Remote Address: 10.235.222.220:80
      Referrer Policy: no-referrer-when-downgrade
  </code></pre>