![]() The difference between the URLs might be something as simple as a trailing slash in the path - for example, you may need to change the URL in your code to add a trailing slash - e.g., (notice the trailing slash) rather than (no trailing slash) - or you might instead need to remove a trailing slash. Change your code to make the request to that other URL directly instead.Check the URL in the Location response header in the response to the OPTIONS request.If you can’t change your code to avoid need for browsers to do a preflight, another option is: ![]() the Content-Type request header has a value other than application/x-www-form-urlencoded, multipart/form-data, or text/plain.you’ve set custom request headers other than Accept, Accept-Language, Content-Language, Content-Type, DPR, Downlink, Save-Data, Viewport-Width, or Width.the request method is anything other than GET, HEAD, or POST.You may be able to adjust your code to avoid triggering browsers to send the OPTIONS request.Īs far as what all’s going on in this case, it’s important to know browsers do a CORS preflight if: ![]() To avoid the error, your request needs to get a 2xx success response instead. ![]() 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. But that’s not the only cause - just the most common. Short answer: Ensure the request URL in your code isn’t missing a trailing slash.Ī missing-trailing-slash problem is the most-common cause of the error cited in the question. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |