I'm trying to make Cross-Domain webservice calls from an HTTP page to an HTTPS service.
I have set up the proper CORS headers on the server (it works with HTTP-HTTP and HTTPS-HTTPS).
It does work if I change the requests to JSONp.
What I'm seeing in Chrome and Firefox is the HTTPS request is never sent, it's immediately aborted, and the server never sees the request.
It is worth noting that the preflight OPTIONS
request is aborted (and it doesn't reach the server).
I can't find any source that explains that this is indeed not possible (HTTP to HTTPS) and better yet: explains why. I can understand HTTPS to HTTP is unsafe, but the othe way around should be fine right? It seems silly to me because JSONp works (but it's messy).
notes
I also have withCredentials
set to true
and I'm sending some custom headers and a custom Content-Type
: application/json
I'm using the regular XMLHTTPRequest with fallbacks to JSONp for IE<=9
Ok, I figured it out. The certificate I'm using for the HTTPS domain is self-signed and unverified. Adding it to the list of trusted third-party authorities fixed it for me.
You can install the certificate in Windows 7 through IE. This worked for me: http://productforums.google.com/forum/#!topic/chrome/bds-Ao9LigA%5B1-25%5D post by
zacharysyoung 2/11/09
Make sure you run IE(9) as administrator or the install will fail even-though it says it installed it correctly.Aside from that, I think I may have discovered a bug in Chrome. See: https://code.google.com/p/chromium/issues/detail?id=141839
It might be easier to setup something like easyXDM. It is rather quick to get going and will do all the backwards compatibility for you (all the way to IE6). It might not be the home-grown solution you are looking for but if you want cross-domain (where you have access to both sides) in a hurry it fits the bill.
You could always write your own iframe (postMessage) interface but why re-invent the wheel (and don't forget to set your document.domain if you are using different sub-domains).