Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular and self-signed SSL cert - ERR_INSECURE_RESPONSE

Tags:

angularjs

ssl

I have a need to connect my angular $resources to a self-signed https web api. If I try to do that directly, I have messages such as

OPTIONS https://address/api/authentication net::ERR_INSECURE_RESPONSE

Is there a way to overcome this error, by any means specifying that this particular connection is trusted?

like image 299
onkami Avatar asked May 16 '14 14:05

onkami


Video Answer


2 Answers

This does not really overcome the problem, but is a suitable workaround if you do web UX development and just need to see your changes in the browser in a dev env:

Whatever the backend api URL is that angular is calling, just open another tab to that URL and accept the invalid certificate warning in the browser. After this the app will work against the invalid certificate until you close the browser.

Tested in IE and Chrome.

like image 131
j0ffe Avatar answered Sep 30 '22 17:09

j0ffe


Unfortunately it won't work unless you're running your frontend on the same origin as the web api.

AJAX calls to untrusted (self-signed) HTTPS fail silently

like image 45
Daniel Varela de Almeida Avatar answered Sep 30 '22 17:09

Daniel Varela de Almeida