gpt4 book ai didi

ssl - 如何在 Vue CLI 中使用 SSL 进行本地开发?

转载 作者:太空宇宙 更新时间:2023-11-03 13:20:23 25 4
gpt4 key购买 nike

我了解在 Vue CLI 中使用 https 我可以在 vue.config.js 文件中的 devServer 下设置“https: true”,但我还需要一个自签名证书。

我尝试使用 OpenSSL 生成一个自签名的,并在我的 vue.config.js 文件中使用以下内容作为目标:

const fs = require('fs');

module.exports = {
devServer: {
port: '8081',
https: {
key: fs.readFileSync('./certs/server.key'),
cert: fs.readFileSync('./certs/server.cert'),
},
},
};

Chrome 确认它正在使用我的证书,但仍将 https 显示为“不安全”

enter image description here

如何让 chrome 在通过 Vue CLI 提供自签名证书时将其评估为安全?

最佳答案

只需在您的 Chrome 中输入此内容

chrome://flags/#allow-insecure-localhost

设置为Enabled,重新启动 Chrome,一切顺利。

关于ssl - 如何在 Vue CLI 中使用 SSL 进行本地开发?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55813348/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com