angular - 使用 ssl 运行角度
问题描述
我想在 localhost ( https://localhost:4200 ) 上使用 ssl 证书运行我的 Angular (7+) 项目。
我从这个链接源尝试了以下内容 - Get angular-cli to ng serve over HTTPS:
1)角度.json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"projects": {
"<PROJECT-NAME>": {
"architect": {
"serve: {
"options": {
"sslKey": "<relative path from angular.json>/server.key",
"sslCert": "<relative path from angular.json>/server.crt",
...
}, ...
}, ...
}, ...
}, ...
}, ...
}
2)浏览器同步
ng serve --ssl true --ssl-key /node_modules/browser-sync/lib/server/certs/server.key --ssl-cert /node_modules/browser-sync/lib/server/certs/server.crt
当我跑步时:ng serve--ssl
我得到这个日志:
** Angular Live Development Server 正在监听 localhost:4200,在https://localhost:4200/上打开浏览器**
在浏览器中
解决方案
推荐阅读
- angular - 如何在 Angular 5 中使用 $q.all 和 $q.defer?
- prestashop - PrestaShop - 在其他结帐步骤中获取购物车内容
- c# - 使用 UriBuilder 构建我的 URI 在其中一个参数中添加了一个奇怪的字符 %u200b
- html - 正则表达式将 target="_blank" 添加到所有链接,但排除已经具有 target="_blank" 的链接或具有和的链接
- javascript - 使用 `jest.useFakeTimers()` 时,为什么 `setImmediate` 不会无限期超时?
- dictionary - 将字母与其值相关联并在python中对输出进行排序
- jquery - HTML,jQuery - 更新表单后打印值 - 输入数组
- java - 无法安装 java sdk,webupd8team repo 给出 sha256 错误,并且来自 oracle 的 tar.gz 在 Ubuntu 18.04 上给出了损坏的输出
- batch-file - 如何编写搜索文件名并将它们复制到文件夹的批处理脚本
- javascript - AngularFireStorage 上传多张图片?