我正在开发基于 yeoman 的 angular.js 应用程序。
我们已将 gruntfile 设置为在 https 上运行。
它在我的同事机器上运行良好,但在我的机器上运行良好。
在 Chrome 中我得到:
SSL connection error.
Unable to make a secure connection to the server.
This may be a problem with the server, or it may be requiring a client authentication certificate that you don't have.
在 Firefox 中,我得到:
The connection was interrupted
The connection to localhost:9000 was interrupted while the page was loading.
The site could be temporarily unavailable or too busy. Try again in a few moments.
If you are unable to load any pages, check your computer's network connection.
If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.
我已经仔细检查了我们安装了相同的 npm 模块。
gruntfile 的相关部分是
connect: {
options: {
port: 9000,
hostname: 'localhost',
protocol: 'https',
key: grunt.file.read('server.key').toString(),
cert: grunt.file.read('server.crt').toString(),
ca: grunt.file.read('ca.crt').toString(),
passphrase: 'grunt',
},
livereload: {
options: {
protocol: 'https',
middleware: function (connect) {
return [
modRewrite([
'^/api/(.*) /api/index.php?$1 [L]',
'!\\.html|\\.js|\\.php|\\.css|\\.png$ /index.html [L]'
]),
lrSnippet,
phpGateway('app'),
mountFolder(connect, '.tmp'),
mountFolder(connect, yeomanConfig.app)
];
}
}
},
我的同事生成了证书文件,但这并不重要,因为我有这些文件的确切副本。
最奇怪的部分是我仍然可以通过 http 运行该站点,而在我的同事机器上它根本不会通过 http 运行,只有 https。
还有其他人可以想到为什么会这样吗?