Inconsistent CORS Error, preflight successful, actual request cancelled

-1

I have an issue with a CORS request. The problem is that it's not at all consistent, sometimes it works with no issues, sometimes it only works on Chrome, and sometimes not at all.

But the most frequent way it manifests itself is that the OPTIONS preflight request passes without any issues, but the actual request, a POST request, is canceled by the browser. The Origin header in the request matches the Access-Control-Allow-Origin header in the preflight response.

The errors I get in the console are:

  • Firefox:

    Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:... . (Reason: CORS request did not succeed).

  • IE:

    SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.

  • Chrome: No error appears, just that the request is canceled.

If I make the request "manually", using "Edit and Resend" from the Firefox Network tab, it works without any issue.

Also, some other times the OPTIONS preflight request is canceled by the browser without any changes being made to the server code or the client code.

http
browser
cors
asked on Stack Overflow Aug 27, 2018 by Mihai Ciully • edited Aug 28, 2018 by Mihai Ciully

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0