[Angular] Run Angular CLI with https
2023-09-14 08:59:14 时间
Generate a certificate
git clone https://github.com/RubenVermeulen/generate-trusted-ssl-certificate.git
cd generate-trusted-ssl-certificate
bash generate.sh
You should now have a server.crt and a server.key file in the repository folder.
Install the certificate (MacOS)
- Double click on the certificate (server.crt)
- Select your desired keychain (login should suffice)
- Add the certificate
- Open Keychain Access if it isn’t already open
- You should see the certificate localhost, double click it
- Expand Trust tab
- Select the option Always Trust in When using this certificate
- Close the certificate window
Configure the application
create a ssl folder in applciation
angular-app: - e2e - src - ssl .angular-cli.json
Copy the private key and root certificate from step 1 into the ssl folder. Make sure the file names are like this:
server.key (private key)
server.crt (root certificate)
Update package.json:
"start": "ng serve --ssl --ssl-key ./ssl/server.key --ssl-cert ./ssl/server.crt",
Run:
npm start
相关文章
- angular框架如何实现父子组件传值、非父子组件传值
- angular debounce throttle「建议收藏」
- Angular 结合 dygraphs 实现 annotation
- 前端必读3.0:如何在 Angular 中使用SpreadJS实现导入和导出 Excel 文件
- 如何在Angular项目中使用MQTT
- 前端人员该怎么面试 经典Angular面试题有哪些[通俗易懂]
- vue相比jquery_angular和vue哪个厉害
- 【Angular教程】自定义管道
- Angular 应用如何回退到之前曾经浏览过的页面
- Angular 项目中 angular.json builder 字段的可选项介绍
- Angular 6.0 即将发布 承诺更小更快更易用
- angular.foreach循环方法使用指南