Bernd
Bernd

Reputation: 825

How to setup Angular "Native Federation" to serve via https in development mode

My regular Angular setup for the "serve" section in angular.json looks like this:

"serve": {
  "builder": "@angular-devkit/build-angular:dev-server",
    "options": {
      "sslKey": "./dev-server-certs/localhost.key",
      "sslCert": "./dev-server-certs/localhost.crt",
      "ssl": true
    }
},

This works well. Now I've created a shell application which should load other micro frontends. The automatically generated "serve" section (created by Native Federation) looks like this:

"serve": {
  "builder": "@angular-architects/native-federation:build",                  
    "options": {
      "target": "shell:serve-original:development",
      "rebuildDelay": 0,
      "dev": true,
      "port": 0
    }
}

I tried to add the ssl... keys too, but when running ng serve I still get http://localhost:4xxx as the link to be used. I was not able to find a way how to serve the new shell application (and the remotes) via https.

Upvotes: 0

Views: 380

Answers (1)

Fábio Dauer
Fábio Dauer

Reputation: 1

It should works:

"serve-original": {
  "builder": "@angular-devkit/build-angular:dev-server",
  "configurations": {
    "production": {
      "buildTarget": "shell:esbuild:production"
    },
    "development": {
      "buildTarget": "shell:esbuild:development"
    }
  },
  "defaultConfiguration": "development",
  "options": {
    "port": 4200,
    "sslKey": "./dev-server-certs/localhost.key",
    "sslCert": "./dev-server-certs/localhost.crt",
    "ssl": true
}

Upvotes: 0

Related Questions