在内部开发环境中,我们使用证书进行登录。我目前正在使用cypress来自动化测试。我不完全确定我是否要采用正确的方法,但是我能够传递用户证书,因为它绕过了必须选择证书的工作,但是不确定如何也传递根证书也可以安全地登录。
这是到目前为止的示例代码:
const httpProxy = require('http-proxy'),
fs = require('fs');
const cert = fs.readFileSync('./usercert.p12'),
cacert = fs.readFileSync('./cacert.pem');
const proxy = httpProxy.createProxyServer({
target: {
host: 'devenvironment.org',
protocol: 'https:',
port: 443,
pfx: cert,
passphrase: 'password',
ws: true
},
secure: false,
changeOrigin: false,
xfwd: true,
agent: false
}).listen(8000);