jquery ajax withcredentials,javascript - Cross domain jQuery ajax call with credentials - Stack Over...

I've followed the following steps:

Get the server to allow cross domain calls (with all the headers and stuff) This works

Test the server with some cross domain calls This works

Get the server to force a certificate This works

Go to a file on the server with a browser, choose the right certificate and see the file Still works

Now we get to the nice part

Combine the cross domain calls with the certificate

Problem

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.

Code

$.ajax({

type: "POST",

xhrFields: {withCredentials: true},

dataType: "xml",

contentType: "text/xml; charset=\"utf-8\"",

url: "https://www.myOtherServer.com/testfile.asp",

});

Any ideas?

Edit

The Access-Control-Allow-Credentials: true and the Access-Control-Allow-Origin are properly configured.

Additional information

I'm starting to think that it has something to do with the content type. When I change it to "text/html" I get a 415 error, but I do really need to send xml because it is a SOAP server.

Response headers

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

Request headers

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值