'An unhandled exception occurred: Dev-server address info is not defined
When I try to use ng serve using ssl with custom host name I will get the An unhandled exception occurred: Dev-server address info is not defined. error. I was wondering if anyone has a solution for this problem.
ng serve --host myapp.local --port 4200 --ssl --ssl-key 'certs/myapp.local.key' --ssl-cert 'certs/myapp.local.crt'
myapp.local is set to 127.0.0.1 at the host file. and I also added
"options": { "disableHostCheck": true, "allowedHosts": ["myapp.local"], "sslCert": "certs/myapp.local.crt", "sslKey": "certs/myapp.local.key", "browserTarget": "latest-angular:build", "host": "myapp.local", "port": 4200, "ssl": true }
Any helps would be appreciated!
Solution 1:[1]
In my case, the problem was with the not correctly generated self-signed certificate. This command has correctly generated the certificate:
openssl req -newkey rsa:2048 -keyout localhost.key -x509 -days 3650 -out localhost.crt -nodes -sha256
Solution 2:[2]
I had this exact error, doing the same thing.
For me, it was a problem to do with the location of the certificate - I had some incorrect casing referring to it :facepalm: Fixing the casing solved the issue.
"sslCert": "../Development/ssl/... should have been "sslCert": "../development/ssl/...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Krzysztof Krupa |
| Solution 2 | Jared Whittington |
