Polymer 为什么SimpleHTTP2Server无法在本地主机上加载服务工作进程

Polymer 为什么SimpleHTTP2Server无法在本地主机上加载服务工作进程,polymer,polymer-1.0,http2,Polymer,Polymer 1.0,Http2,当我尝试使用端口5000在本地主机上运行本地绑定和非绑定版本时,对service-worker.js的请求失败: An SSL certificate error occurred when fetching the script. https://localhost:5000/service-worker.js Failed to load resource: net::ERR_INSECURE_RESPONSE (index):1 Uncaught (in promise) DOMExcep

当我尝试使用端口5000在本地主机上运行本地绑定和非绑定版本时,对service-worker.js的请求失败:

An SSL certificate error occurred when fetching the script.
https://localhost:5000/service-worker.js Failed to load resource: net::ERR_INSECURE_RESPONSE
(index):1 Uncaught (in promise) DOMException: Failed to register a     ServiceWorker: An SSL certificate error occurred when fetching the script.
有没有一个简单的方法让它工作?我尝试了许多启动标志,如:

chrome.exe --ignore-certificate-errors --incognito
--unsafely-treat-insecure-origin-as-secure --allow-insecure-localhost
但这没有帮助,我仍然得到:

(index):1 Uncaught (in promise) DOMException: Failed to register a ServiceWorker: An SSL certificate error occurred when fetching the script.

根据alesc的建议,我找到了说明:

以下是Windows 10上Chrome 55的说明。看来这些步骤可能会经常改变

  • 在带有不受信任证书的页面(https://用红色划掉)上,单击锁,这样会打开一个弹出窗口
  • 单击顶部信息部分下的详细信息链接
  • 单击查看证书按钮
  • 单击详细信息选项卡
  • 单击“复制到文件”
  • 单击下一步
  • 导出为PKCS#7
  • 打开Chrome设置>显示高级设置>HTTPS/SSL>管理证书
  • 将在步骤7中创建的证书导入“中间证书颁发机构”选项卡和“受信任的颁发机构”选项卡
  • 重新启动Chrome并打开本地主机站点

  • 服务工作人员仅使用受信任的SSL证书。您可以将您的自签名证书添加到受信任证书列表中,以绕过此操作(这显然只适用于您)。谢谢,alesc,这很有效。