I've spent several days trying to identify why my CORS applications suddenly began to fail in Chrome when I updated from Chrome v36.xxx to v37.yyy (specifically 37.0.2062.103 ) In my application I run an MVC site and a WebAPI on a different port. This is where the cross-domain comes into things.
I've got several instance (dev, uat, prod) all acting the same way. All used to work.
XMLHttpRequest cannot load http://"mywebapihost":"mywebapiport"/api/v1.0/myapp/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://"mymvchost"' is therefore not allowed access.
Seems to be a problem with the OPTIONS request in the Preflight - which I've seen mentioned a lot on the web.
However - I don't feel any closer to "fixing" my problem (where "fixing" == being able to run in Chrome).
Things I can state about my system :
(1) Has always worked with v36.xxx, but not since 37.0.2062.103 update (2) Works in IE (3) Works for GETs even in latest Chrome (4) Works, even in latest Chrome. if I have Fiddler running (I don't count this as a fix!)
What I've tried.
1) Forcing headers in the calling jQuery Ajax call to try to get the authorization into the OPTIONS call - suggestions from the web
beforeSend: function (xhr) {
xhr.setRequestHeader('Authorization', make_base_auth("<username>", "<password>"));
},
headers: {
"Authorization": "Basic " + btoa("<username>" + ":" + "<password>")
}
2) I downloaded Chrome Canary v39.0.2150.3 in the hope that this issue would be gone - still get same failures.
If anyone has any suggestions I would be very grateful, I've have to change to running IE just to make progress!