Webpack-dev-server 证书过期?

Webpack-dev-server certificate expired?

在我的 webpack.config.js 文件中,我添加了 https 配置:

devServer: {
    historyApiFallback: true,
    contentBase: './',
    https: true
}

然后我在导航到 https://localhost:8080/

时收到错误消息
Your connection is not private

Attackers might be trying to steal your information from localhost (for example, passwords, messages, or credit cards). NET::ERR_CERT_AUTHORITY_INVALID
Subject: webpack
Issuer: webpack
Expires on: Dec 10, 2015
Current date: Mar 27, 2016
PEM encoded chain: -----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE----

webpack 的证书似乎已过期。我配置不正确吗?还是我误解了 SSL?

我正在使用

"webpack": "^1.12.9",
"webpack-dev-server": "^1.14.1"

编辑:

正如 Markus 在评论中指出的那样,webpack-dev-server 从 2.5.0 版本开始自动生成证书。


旧答案:

问题是webpack-dev-server的自签名证书过期了。这已在 #436.

中修复