javascript - HTTP preflight (OPTIONS) request fails in IE only -
i trying make post request rest api. here code snippet (using angularjs):
$http({ method: 'post', url: url, data: reqbody, headers: { 'content-type': 'application/json' } }) .then(function (response) {...}) .catch(function (error) {...}); according this article, because of http header
'content-type': 'application/json'
browser concludes have make "not-simple" http request requires handshake server (http options request sent before actual http request).
chrome handles request charm, ie (11 in case) fails following messages:
the thing is, http options response contains browser needs proceed actual http request.
i found reason mess.
the api service , website located on same domain, on different ports. specific, api service located on:
mydomain.com/apiservice
and website located on:
mydomain.com:44443/website
thus, when web browser initializing call from:
mydomain.com:44443/website/page1
to:
mydomain.com/apiservice/service1
internet explorer blocking call because of cors. reason, chrome less strict in matter, because succeeded make call api.
to make work in internet explorer, moved website same port api:
mydomain.com/apiservice
mydomain.com/website

Comments
Post a Comment