how to run angular with ssl

Viewed 293

I try to run angular with ssl

here is an extract of angular.json

    "serve": {
      "builder": "@angular-devkit/build-angular:dev-server",
      "options": {
        "browserTarget": "frontend:build",
        "sslKey": "keystore.p12",
        "sslCert": "myCertificate.crt",
        "ssl": true
      },
      "configurations": {
        "production": {
          "browserTarget": "frontend:build:production"
        }
      }
    },

When I run ng serve, I have the following error message

Generating browser application bundles...An unhandled exception occurred: error:0909006C:PEM routines:get_name:no start line
See "/private/var/folders/y7/g22dxgr12lvfsc1cn1q1v6_40000gn/T/ng-TNcET2/angular-errors.log" for further details.
1 Answers

the key and certificate were not good. I found that if I apply the following code

"serve": {
      "builder": "@angular-devkit/build-angular:dev-server",
      "options": {
        "browserTarget": "frontend:build",
        "ssl": true
      },

and run ng serve, the key and certificate are automatically generated. In development mode, to make it run, I can generate the key and certificate files and install them on the local computer so the browser recognize them.

But How to add ssl facility in production mode

Related