Jump to content

Access to XMLHttpRequest from origin has been blocked by CORS policy


Recommended Posts

Guest Sandeep_Goyal
Posted

Symptom

 

Access to XMLHttpRequest from origin has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status" error.

 

 

 

Access to XMLHttpRequest from origin has been blocked by CORS policy: Cannot parse Access-Control-Allow-Methods response header field in preflight response.

 

 

 

Cause

 

Invalid CORS header values are causing this problem.

 

 

 

Resolution

 

Please check network HAR traces in browser and verify what headers were sent in the request.

 

Confirm that the OPTIONS HTTP verb is not blocked in IIS -> Request Filtering -> HTTP Verbs tab. Please find below screenshots for your reference.

 

Scenario 1

 

 

largevv2px999.png.1ab253b4505f08074c634ac6c22076ae.png

 

Scenario 2

 

 

 

largevv2px999.png.17a7992733b5b1c8a9635f3d1490243e.png

 

 

Please check the values of the headers in IIS and if customer is using any application gateway verify if they are modifying their values. If yes, then please check the below CORS header values. And verify they confirm with the spec.

 

CORS Header Name Example
Access-Control-Allow-Credentials - HTTP | MDN (mozilla.org) TRUE
Access-Control-Allow-Headers - HTTP | MDN (mozilla.org) Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers,Authorization
Access-Control-Allow-Methods - HTTP | MDN (mozilla.org)
GET,POST,PUT,OPTIONS
Access-Control-Allow-Origin - HTTP | MDN (mozilla.org) *

 

Continue reading...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...