I have to connect by Angular 11 to outside service with custom certificate. Client send me certificate, I tested it in postman (add .crt and .key files) and all requests works fine. Problem start on Angular and https request. I get error response in console:
POST https://XXXXX net::ERR_BAD_SSL_CLIENT_AUTH_CERT
I can't find answer where add content from files .crt and .key below piece of my code.
export class RestConnectionService {
constructor(private httpClient: HttpClient) {
}
public send(queryBody: InputAuthBody): Promise<any> {
return this.httpClient.post(AppSettings.API_URL + 'XXX', queryBody).toPromise();
}
}
I had to do connection server to server. nginx with reverse proxy solve my problem nginx conf code part to add cert:
location /XXXX/XXXX {
proxy_ssl_certificate /etc/nginx/certs/XXX.crt;
proxy_ssl_certificate_key /etc/nginx/certs/XXX.key;
proxy_pass https://XXX:port/XXXXX/XXXX;
}