我正在尝试通过https连接本地主机。因为在生产时,它将被正确的IP替换为有效的SSL,但是在本地主机上,它正在向电子上抛出错误。
如何通过仅在测试的本地主机上取消SSL检查来避免错误,我将在production.Please帮助上删除该检查。
发布于 2018-01-03 06:38:37
克里斯给出了一个确切的解释。只是张贴相同的代码
win = new BrowserWindow({
width: 900,
height: 680,
webPreferences: {
webSecurity: false
}
});
//second alternative
app.commandLine.appendSwitch('ignore-certificate-errors');
发布于 2018-01-02 19:00:30
在BrowserWindow
对象中,将webPreferences.allowRunningInsecureContent
设置为true,将webPreferences.webSecurity
设置为false。这应该能抑制这些错误。
更多信息:https://github.com/electron/electron/blob/master/docs/api/browser-window.md
如果这不能解决问题,请查看有关绕过证书错误的文档:https://electronjs.org/docs/api/app#event-certificate-error
https://stackoverflow.com/questions/48058838
复制相似问题