我正在尝试使browsersync加载到http2.0中。浏览器同步运行没有问题,但是当我尝试访问该应用程序时却出现了
$ curl -I https://foo-demo.com
curl: (35) error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
我在https和http 1上没有这个问题,只有http 2和https。有人知道怎么了吗?
develop /home/one/gitlab/sp6-client # node -v
v10.16.1
develop /home/one/gitlab/sp6-client # browser-sync --version
2.26.7
develop /home/one/gitlab/sp6-client # cat bs-config-work.js
const express = require('express');
const app = express();
const resolve = require('resolve');
const http2Module = require.resolve('http2');
const historyApiFallback = require('connect-history-api-fallback');
const httpProxy = require('http-proxy');
const path = require('path');
const bs = require('browser-sync').create();
const proxyBackEnd = httpProxy.createProxyServer({
target: 'http://127.0.0.1:3000/'
});
const proxyMiddleware = function(req, res, next) {
if (
req.url.match(/\WV1\W/)
|| req.url.match(/\Wv1\W/)
) {
try {
console.log('aaa');
proxyBackEnd.web(req, res);
} catch(e) {
console.log(e);
}
} else {
next();
}
};
app.use(historyApiFallback());
bs.init({
server: true,
baseDir: ['/'],
notify: false,
"files": [
'index.*',
'src/*',
'src/css/*.css',
'src/**/*',
'src/**/**/*',
'src/**/**/**/*'
],
httpModule: http2Module,
middleware: [proxyMiddleware, historyApiFallback(), app],
https: {
key: "work-ssl/ssl/private-key.pem",
cert: "work-ssl/ssl/certificate.pem",
ca: "work-ssl/ssl/ca.pem"
},
"port": 443,
"ui": {
"port": 5001,
},
});