Node.js 通过代理向微信发送请求 SSL证书问题???
发布于 5 年前 作者 WhyNM 4623 次浏览 来自 问答

Node.js 通过代理向微信发送请求 SSL证书问题??? router.get(’/’, function(req, res, next) { var code=req.query.code console.log("code=: " + code); var fs = require(‘fs’) , path = require(‘path’) , certFile = path.resolve(__dirname, ‘…/ssl/client.crt’) , keyFile = path.resolve(__dirname, ‘…/ssl/client.key’) , caFile = path.resolve(__dirname, ‘…/ssl/ca-cert.pem’) , request = require(‘request’); var options = { url: ‘https://api.weixin.qq.com/sns/oauth2’, cert: fs.readFileSync(certFile), key: fs.readFileSync(keyFile), passphrase: ‘password’, ca: fs.readFileSync(caFile) } /** * https.get的第一个参数如果为字符串会自动url.parse()转换为options的对象形式 */ request.get(options); res.render(‘indesx’, { title : “贝珍珠宝” }) })

2 回复

_tls_common.js:85 c.context.setKey(options.key, options.passphrase); ^

Error: error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt at Error (native) at Object.createSecureContext (_tls_common.js:85:19) at Object.exports.connect (_tls_wrap.js:999:46) at /home/kaisun/PearlShop/node_modules/tunnel-agent/index.js:201:28 at ClientRequest.onConnect (/home/kaisun/PearlShop/node_modules/tunnel-agent/index.js:162:7) at ClientRequest.g (events.js:260:16) at emitThree (events.js:97:13) at ClientRequest.emit (events.js:175:7) at Socket.socketOnData (_http_client.js:343:11) at emitOne (events.js:77:13) 现在报这个错

用NGINX代理一下可以省下一堆事

回到顶部