3

I am using an xhr to make a cross domain POST request to a service that is hosted on another server. I have enabled CORS by setting the required headers on the server's IIS, viz. Access-Control-Allow-Origin as '*' and Acces-Control-Allow-Headers as 'content-type, x-request-with', etc.

This xhr is part of the script for a site (say X).

  1. When X is hosted on my machine (IIS), I am able to make the CORS request when I access the site as http: //localhost/X. Whereas when I browse to http: //my-machine-name/X, I get the Access Denied error (as observed from IE's debugger).
  2. When X is hosted on another server and when I access X from my machine, I get the Access Denied error once again.

Also note the following points:

  1. From Chrome, CORS is working properly. I can see the OPTIONS request at first from fiddler. From IE11 however, the request is not even sent.
  2. Access data sources across domains is set to Disable on IE 11. I do not want to change that setting.
  3. When I disabled the option (from point 2), I noticed that the requests are being sent with no ORIGIN header by IE 11. From localhost however, the ORIGIN is set as 'http //localhost'. Chrome sets the ORIGIN as 'my-machine-name' even when I browse to X using http: //my-machine-name/X.
  4. I have also tried using an ajax post request. I get the same error in IE 11 when I use that as well.

Please help me out here. I want to know why IE 11 is not setting the ORIGIN header in the cases mentioned, as I believe that to be the reason why CORS isn't working.

CraigTeegarden
  • 8,173
  • 8
  • 38
  • 43
  • Don't suppose you ever solved this did you? Just hit something similar and trying to find information about it. – MrPurpleStreak May 07 '14 at 12:44
  • Possible duplicate of [Why does the preflight OPTIONS request of an authenticated CORS request work in Chrome but not Firefox?](http://stackoverflow.com/questions/15734031/why-does-the-preflight-options-request-of-an-authenticated-cors-request-work-in) – Paul Sweatte Aug 13 '16 at 06:20

0 Answers0