Self signed certificate error in ASP.NET Core and Angular SSR application

  Kiến thức lập trình

I am developing ASP.NET Core and Angular SSR application.
I get error message: “Http failure response for https://127.0.0.1:44300/api/settings: 0 undefined, cause: Error: self-signed certificate”, when I send API request.

My launch script is:
“scripts”: {
“ng”: “ng”,
“start”: “run-script-os”,
“build”: “ng build”,
“watch”: “ng build –watch –configuration development”,
“test”: “ng test”,
“prestart”: “node aspnetcore-https”,
“start:windows”: “ng serve –ssl –ssl-cert “%APPDATA%ASP.NEThttps%npm_package_name%.pem” –ssl-key “%APPDATA%ASP.NEThttps%npm_package_name%.key” –host=127.0.0.1″,
“start:default”: “ng serve –ssl –ssl-cert “$HOME/.aspnet/https/${npm_package_name}.pem” –ssl-key “$HOME/.aspnet/https/${npm_package_name}.key” –host=127.0.0.1″
}

My angular.json settings file:
“serve”: {
“builder”: “@angular-devkit/build-angular:dev-server”,
“configurations”: {
“production”: {
“buildTarget”: “aspnetcoreangular.client:build:production”
},
“development”: {
“buildTarget”: “aspnetcoreangular.client:build:development”,
“port”: 44301,
“proxyConfig”: “src/proxy.conf.js”,
“ssl”: true
}
},
“defaultConfiguration”: “development”
}

It works with browser side rendering, but not with SSR.

New contributor

Ihor Kasianov is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT