title: Cross domain jQuery ajax call with credentials
body: <p>I've followed the following steps:   </p>
  
  <ol>
  <li>Get the server to allow cross domain calls (with all the headers and stuff) <em>This works</em>  </li>
  <li>Test the server with some cross domain calls <em>This works</em>  </li>
  <li>Get the server to force a certificate  <em>This works</em>  </li>
  <li>Go to a file on the server with a browser, choose the right certificate and see the file <em>Still works</em><br>
  <strong>Now we get to the nice part</strong> </li>
  <li>Combine the cross domain calls with the certificate <strong>&lt;-- this does not work</strong>  </li>
  </ol>
  
  <p><strong>Problem</strong>  </p>
  
  <p>I am getting the certificate request from the browser, but when I select the same certificate as I do when using the browser, the call is made but I get a 403 Forbidden.  </p>
  
  <p><strong>Code</strong>  </p>
  
  <pre><code>$.ajax({
       type: "POST",
       xhrFields: {withCredentials: true},
       dataType: "xml",
       contentType: "text/xml; charset=\"utf-8\"",
       url: "https://www.myOtherServer.com/testfile.asp",
  });
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p><strong>Edit</strong>  </p>
  
  <p>The <code>Access-Control-Allow-Credentials: true</code> and the <code>Access-Control-Allow-Origin</code> are properly configured.   </p>
  
  <p><strong>Additional information</strong>  </p>
  
  <p>I'm starting to think that it has something to do with the content type. When I change it to <code>"text/html"</code> I get a <code>415</code> error, but I do really need to send xml because it is a SOAP server.</p>
  
  <p><strong>Response headers</strong>  </p>
  
  <pre><code>Access-Control-Allow-Cred...    true
  Access-Control-Allow-Head...    Content-Type, Origin, Man, Messagetype, Soapaction, X-Test-Header
  Access-Control-Allow-Meth...    GET,POST,HEAD,DELETE,PUT,OPTIONS
  Access-Control-Allow-Orig...    https://www.mywebsite.com
  Access-Control-Max-Age  1800
  Cache-Control   private
  Content-Length  5561
  Content-Type    text/html; charset=utf-8
  Date    Wed, 19 Dec 2012 15:06:46 GMT
  Server  Microsoft-IIS/7.5
  X-Powered-By    ASP.NET
  </code></pre>
  
  <p><strong>Request headers</strong></p>
  
  <pre><code>Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  Accept-Encoding gzip, deflate
  Accept-Language nl,en-us;q=0.7,en;q=0.3
  Access-Control-Request-He...    content-type
  Access-Control-Request-Me...    POST
  Cache-Control   no-cache
  Connection  keep-alive
  Host    myhoast.com
  Origin  https://www.mywebsite.com
  Pragma  no-cache
  User-Agent  Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0
  </code></pre>