I am using Angular http module to make a call to a https endpoint enabled by self signed certificate.
The code is similar to what is showng below:
export class AppComponent {
constructor(private http: HttpClient) {
}
title = 'my-app';
ngOnInit(): void {
this.http.get('https://internalapp.com/context/apps/all').subscribe((res: any[]) => {
console.log('sharief');
console.log(res);
});
}
}
When angular application runs in chrome browser, it results in the error "net::ERR_CERT_AUTHORITY_INVALID". This error occurs on this.http.get(...) method call.
Node's https module has an option shown below and it seems to work (from enter link description here:
var req = https.request({
host: '192.168.1.1',
port: 443,
path: '/',
method: 'GET',
rejectUnauthorized: false,
requestCert: true,
agent: false
},
Question: Is it possible to disable certificate validation during http.get call?
Nope, This is a limitation from the browser.
You can put the back end url in your browser to tell your browser to authorise this call, it will then work.