"resolve 'preflight is invalid (redirect)' or 'redirect is not allowed for a preflight request'"
- 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
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
- you’ve set custom request headers other than
Content-Type request header has a value other than