10

I want to serve my application though SSL previously I had this script:

ng serve --ssl --ssl-key "pathtokey\key.crt"

I want to add SSL in the new angular.json but when i try to add it i got the error:

Schema validation failed with the following errors:
 Data path "" should NOT have additional properties(ssl).

What is the proper way to use SSL with angular cli 6?

1

2 Answers 2

17

In angular.json:

"serve": {
    "builder": "@angular-devkit/build-angular:dev-server",
    "options": {
        "browserTarget": "app:build",
        "ssl": true,
        "sslKey": "path to .key",
        "sslCert": "path to .crt"
    },
    ...
}
Sign up to request clarification or add additional context in comments.

1 Comment

Nice. Somewhere I read if we do ssl true angular will create key, certificates for you. Where can I see the file? In which directory?
2

ANGULAR 6 REQUIRES YOU TO DEFINE THE PARAMS: --ssl-key & --ssl-cert

Create or get trusted certificate key and cert files and place it in C:\certificates\

ng serve --ssl --ssl-key c:\\certificates\\server.key  --ssl-cert c:\\certificates\\server.crt

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.