使用 node-http-proxy 的代理管理器服务器无法处理 HTTPS 网站

问题描述

我正在尝试制作一个基本的代理管理器服务器,该服务器通过随机代理(从列表中)传输我的请求,然后具有更多功能

所以我开始只是通过隧道连接到一个代理:

const http = require('http');
const httpProxy = require('http-proxy');

var proxy = new httpProxy.createProxyServer({
  toProxy: true,});

http
  .createServer(function (req,res) {
    const auth = Buffer.from(`user:pass`).toString(
      'base64',);
    req.headers['Proxy-Authorization'] = `Basic ${auth}`;

    proxy.web(req,res,{
      target: {
        host: 'myproxy.com',port: 99999,},});
  })
  .listen(3000);

这适用于 HTTP (http://linkedin.com),但当切换到 HTTPS 时失败:

错误:无法建立隧道套接字,原因=套接字挂断

我错过了什么?

另外,我要补充的是 satellite (https://www.npmjs.com/package/satellite) 模块正是我正在寻找的,但没有 repo :(

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)