Run Angular 2 app over http and https both

2020-05-01 04:34发布

问题:

Does anybody knows how can I run an Angular 2 app where I can access the app over http and https I mean run listening in two ports 80 and 443 ?

Here is the deal

I have an app that I can run with a ssl certificate, so in order access the app over https I have de following configuration:

"serve": {
      "port": 443,
      "host": "0.0.0.0"
    }

But that limits me to access the app only in port 443 or in other words over https but I need to access the app over http too I mean port 80.

Thanks in advance

回答1:

To configure one application to http or https you need to do nothing in the application itself, https configuration is given by the web server (IIS Apache etc) if your application is installed in the server, you only need to configure the web server to manage a SSL /TLS connection. The ng server as point JB Nized is used only for development. to production use IIS or APACHE or other production web server. See the following link to more information to configure IIS: Configure https in IIS



标签: angular