"resolve 'preflight is invalid (redirect)' or 'redirect is not allowed for a preflight request'"


  1. First of all, ensure that you have "Access-Control-Allow-Origin": "*" in the headers

Ensure the request URL in your code isn’t missing a trailing slash.

A missing-trailing-slash problem is the most-common cause of the error cited in the question.

But that’s not the only cause — just the most common. Read on for more details.

When you see this error, it means your code is triggering your browser to send a CORS preflight OPTIONS request, and the server’s responding with a 3xx redirect. To avoid the error, your request needs to get a 2xx success response instead.

You may be able to adjust your code to avoid triggering browsers to send the OPTIONS request.

As far as what all’s going on in this case, it’s important to know browsers do a CORS preflight if:

  • the request method is anything other than GETHEAD, or POST
  • you’ve set custom request headers other than AcceptAccept-LanguageContent-LanguageContent-TypeDPRDownlinkSave-DataViewport-Width, or Width
  • the Content-Type request header has a value other than application/x-www-form-urlencodedmultipart/form-data, or text/plain


my case I did not have to set the request header to have "Access-Control-Allow-Origin": "*". The url HAD TO be ending with a "/" at the end

happens sometimes when you try calling an https service as http, for example when you perform a request on:

'http://test.com/api/v2/tickets'

Which should be:

'https://test.com/api/v2/tickets'