title: Redirect blocked by CORS
body: <p>I am sending a redirect from POST API to adfs server in form of HttpServletResponse containing an URL with status 302, but it is giving the following error</p>
  
  <blockquote>
    <p>XMLHttpRequest cannot load Resource A. Redirect from Resource A to
    Resource B has been blocked by CORS policy: No
    'Access-Control-Allow-Origin' header is present on the requested
    resource. Origin '<a href="http://localhost:9000" rel="nofollow noreferrer">http://localhost:9000</a>' is therefore not allowed
    access.</p>
  </blockquote>
  
  <p>Where resource A is my api running on '<a href="http://localhost:9000" rel="nofollow noreferrer">http://localhost:9000</a>' and resource B is the adfs server.</p>
  
  <p>I have access-control-allow-origin header in API set to '*' as well .</p>
  
  <p>When I redirect from my api to Google using AngularJS it gets redirected successfully. Should I need to change .htaccess file in web or need a change in the API?</p>
  
  <p>I have already checked</p>
  
  <p><a href="https://stackoverflow.com/questions/10636611/how-does-access-control-allow-origin-header-work?rq=1">How does Access-Control-Allow-Origin header work?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/43816797/redirect-from-a-has-been-blocked-by-cors-policy-origin-b-is-therefore-not-allow">Redirect from A has been blocked by CORS policy. Origin B is therefore not allowed access</a></p>
  
  <p><a href="https://stackoverflow.com/questions/13400594/understanding-xmlhttprequest-over-cors-responsetext/13400954#13400954">Understanding XMLHttpRequest over CORS (responseText)</a></p>