Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 344
djd Avatar asked Mar 16 '26 11:03

djd


2 Answers

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, ...

like image 187
Darin Dimitrov Avatar answered Mar 18 '26 00:03

Darin Dimitrov


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.

like image 36
josh3736 Avatar answered Mar 18 '26 01:03

josh3736



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!