title: Angular: ng-serve ignoring certificates
body: <p>I want to serve an Angular application over HTTPS using <code>ng-serve --host 0.0.0.0</code>. My project uses Angular CLI 1.2.</p>
  
  <p>Angular is not recognising the certificates I provide, and creating its own. The certificates I want to use are <code>.pem</code> files.</p>
  
  <p>Enabling the <code>--ssl</code> flag correctly serves using HTTPS. If I disable it, it goes back to HTTP, so this flag works.</p>
  
  <p>I'm working in a Docker container. I pass the certificates in as a volume in the compose file, and they are where expected in the container when I check with <code>docker exec -i &lt;id&gt; bash</code>.</p>
  
  <p>Everything works as expected if I ignore the invalid certificate error, both client side and server side. The problem I am trying to solve is getting <code>ng-serve</code> to use my certificates.</p>
  
  <p>Here's what I've done:</p>
  
  <ol>
  <li><p><code>ng-serve --ssl true --ssl-cert &lt;path-to-cert&gt; --ssl-key &lt;path-to-key&gt;</code> and variations e.g. absolute/relative path.</p></li>
  <li><p>Setting the above flags in the <code>package.json</code> file.</p></li>
  <li><p>Setting my <code>.angular-cli.json</code> defaults:</p>
  
  <pre><code>{
    ... 
    "defaults": {
      ...
      "serve": {
        "sslKey": "&lt;relative-path&gt;",
        "sslCert": "&lt;relative-path&gt;"
      },
      ...
    },
    ...
  }
  </code></pre></li>
  </ol>
  
  <p>I have tried the answers:</p>
  
  <p><a href="https://stackoverflow.com/questions/39210467/get-angular-cli-to-ng-serve-over-https">Get angular-cli to ng serve over HTTPS</a></p>
  
  <p><a href="https://stackoverflow.com/questions/49994898/run-angular-cli-ng-serve-over-https-2018">Run Angular Cli Ng Serve over https 2018</a></p>
  
  <p>The steps in this article also did not work:
  <a href="https://medium.com/@rubenvermeulen/running-angular-cli-over-https-with-a-trusted-certificate-4a0d5f92747a" rel="noreferrer">https://medium.com/@rubenvermeulen/running-angular-cli-over-https-with-a-trusted-certificate-4a0d5f92747a</a></p>