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?
Open Chrome settings, scroll to the bottom, and click Show advanced settings... Click the Trusted Root Certification Authorities tab, then click the Import... button. This opens the Certificate Import Wizard.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With