djd
djd

Reputation: 1001

Javascript request to SSL request

For our APP we have a Web App and a API service, On A certain event the Web app polls the api service for the state of the event using Javascript. Both the apps run on a separate HTTPS sub domain and with a self signed certificate(as it is still in alpha). The problem occurs that the polling is aborted because the https api connection is untrusted. Is it some way for the Javascript request to override the untrusted certificate issue?

Upvotes: 3

Views: 2057

Answers (2)

josh3736
josh3736

Reputation: 144912

No, you have to add the self-signed certificate to your machine/browser's trusted certificate store.

You also have cross-domain origin issues (the different subdomain), which is separate from any certificate issues. If you're already using JSONP, you're fine; but if you're trying to make an XHR request to a different domain, it's not going to work.

Upvotes: 2

Darin Dimitrov
Darin Dimitrov

Reputation: 1038800

Is it some way for the Javascript request to override the untrusted certificate issue?

No, it's because of the same origin policy restriction.

In your case I suppose that you have a page hosted on https://foo.bar.com and you are trying to send an AJAX request to https://baz.bar.com which is not allowed.

You may take a look at the following guide which covers the different possibilities to circumvent this restriction. They range from JSONP, server side script bridges, Flash proxies, screen scraping with YQL, ...

Upvotes: 4

Related Questions